none
Load latest referenced assembly in Visual Studio Project RRS feed

  • Question

  • I'm working on a component class that, in an ideal environment, should be able to reflect updated information about certain referenced assemblies dynamically. For example I have a project that references assembly A, B, and C. The first time I fire up the component, it displays A, B, and C's information (all properties and methods defined within), but along the way, B was updated and rebuilt (say some methods were deleted and new ones were added). Without having to close Visual Studio, how can I access the new assemblies without locking up the referenced assemblies. I've hit a brick wall here, coz even though I've been using a separate AppDomain to load the assemblies I don't seem to be getting the right ones, the one loaded is always similar to the assembly found within the Assembly Collection System.CurrentAppDomain.GetAssemblies which seems to be a list of referenced assemblies loaded by VS (stored in temp folder), these do not reflect the changes when I rebuilt the referenced assembly: 

    Dim

    setup As New AppDomainSetup
    Dim ref As VSLangProj.Reference = GetReferenceAssembly(assemblyName)
    setup.ApplicationBase = IO.Path.GetDirectoryName(ref.Path)
    setup.ShadowCopyFiles =
    "true"
    setup.CachePath = "C:\dump"
    setup.ApplicationName = "Communicator"
    m_domain = System.AppDomain.CreateDomain("MyProjectDomain", Nothing, setup)

    Dim fs As New FileStream(ref.Path, FileMode.Open)
    Dim buffer(CInt(fs.Length)) As Byte
    fs.Read(buffer, 0, buffer.Length)
    fs.Close()
    domainAssembly = m_domain.Load(buffer)

    System.AppDomain.Unload(m_domain)
    m_domain =

    Nothing
    If System.IO.Directory.Exists("C:\dump") Then System.IO.Directory.Delete("C:\dump", True)

    Friday, September 19, 2008 1:37 AM

All replies

  • Have you resolved anything...this post is confusing, at least to me, because what does assembly versions have to do with runtime issues? If A expects specific version of B which is no longer in the environment...how is VSStudio supposed to handle that? Or am I missing something.
    William Wegerson (www.OmegaCoder.Com)
    Saturday, October 11, 2008 12:57 PM
    Moderator