Solved

Unloading .NET dlls

Posted on 2002-06-29
5
519 Views
Last Modified: 2006-11-17
I wrote a program that needs to be able to get new versions of it's own dll's through the internet.
The problem is that the old dlls which are used by the program are locked. I want to unload them, copy the new dlls, and then load them back for use by the program.

If it isn't prossible I'll probably have to write a second program which performs the update by shutting down my app, doing the dll update and then start my app again... But I really prefer doing it all in one app...

0
Comment
Question by:ArielLaub
5 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7118896
The second program aapproach is normally being done.

You should:
- close the app.
- start the new app, initialize / copy all dll's.
- start the app again.

There is no other way.

CJ
0
 

Expert Comment

by:Fesersoft
ID: 7118904
If you load the Original Assembly into a different AppDomain, you can destroy the Appdomain and the Assembliesw will be released and can be removed or refreshed from the internet.
0
 

Author Comment

by:ArielLaub
ID: 7120040
You are probably right, but I still need a second program to do this. a program cannot unload itself and then reload it...
0
 
LVL 1

Expert Comment

by:Tim_Musschoot
ID: 7120795
Hello,

Try to copy the new DLL's over the old versions.  It works fine for me...

Regards,
Tim
0
 
LVL 4

Accepted Solution

by:
CoolAss earned 100 total points
ID: 7130627
A single application (aka a single process) can have multiple AppDomains.

I suggest placing all updatable assemblies in a second AppDomain, and reserve the first AppDomain for the assemblies that contains the code that is responsible for updating the application.

Also, check out this article about self-updating applications:

http://www.gotdotnet.com/team/windowsforms/appupdater.aspx
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now