Question Updating Dlls (unload and load at runtime)

barkinmadscot

New member
Joined
Apr 23, 2012
Messages
2
Programming Experience
5-10
Hi,

Not sure if this is the correct place for this post


What I am trying to do is update dll's in my application.

Using VB with dotnet 2 (Visual Studio 2010)

The Project has a number of Dll's one of each department i.e. Sales is sales.dll... Development is development.dll etc....

Each dll has classes/User controls which is used and dispose depending on the section within the application.

Once work has been completed with a dll, it put in the deployment area, currently another is program launching checks the file verison and updates as required, before the main application lauches, this works. The exe hasn't needed updated for a long time as all the changes are in the dlls.

What i have been looking at is update method for the dll's dymanically, when not in use, when the dll called into use or disposed of.

I have looking at LoadLibrary/FreeLibrary and application.domain. I have been reading loads and tried out some of the examples, with a modified to suit. I am just not getting it.

Is this possible?

Thanks for any advice & help in advance

Cheers

Barry
 
Last edited:
###### Version Check Code Here ########

'Create evidence for the new appdomain.
Dim adevidence As System.Security.Policy.Evidence = AppDomain.CurrentDomain.Evidence

'Create the new application domain.
Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence)
Console.WriteLine(("Host domain: " + AppDomain.CurrentDomain.FriendlyName))
Console.WriteLine(("child domain: " + domain.FriendlyName))

' Unload the application
domain.AppDomain.Unload(domain)

Try
' Note that the following statement creates an exception because the domain no longer exists.
Console
.WriteLine(("child domain: " + domain.FriendlyName))
Catch e As AppDomainUnloadedException
Console
.WriteLine("The appdomain MyDomain does not exist.")
End Try
##### Copy Dll Here ##########


I compare the verisons first, before entering this part of the code. The first time it works, but a secound time when copying Dll I get the error message 'File in use by another process.'

I chaeck all classes/Variables etc related to that Dll, all appear not be in use either Nothing or NULL

I am guessing because Dll has been used(Loaded) something is/hasn't released it correctly.Anyone got any idea where i should start looking

Cheers
 
No one is replying this thread ? :sour:

I am trying to do something like this recently but cannot find anyway out of it. It worked for the 1st time but after the program were executed, and the version rolls up the error will prompt out because the dll is still loaded and we need to unload the dll before the dll can get updated.


Anyone here can please help?

Thanks,
SY
 
Back
Top