Solved

Unloading .NET dlls

Posted on 2002-06-29
5
523 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Json POSt to Rest API 4 61
Where can I ask about my ASP.NET MVC project? 6 36
Code works but it's slow 28 70
List<PaisEntity> - show some 1 24
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

776 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