How to unload assembly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

HI All,
i load assembly like this

Asembly v_asm = System.Reflection.Assembly.LoadFile("MYdll.dll");

and initialize class with

object v_obj = Activator.CreateInstance(....);

but How can I unload dll when i don' t need it?

thanks for help

Jan
 
Hi Jan,

..NET does not support to unload assemblies once they are loaded on an
app-domain, so you will have to use a secondary app-domain and unload the
whole app-domain. See:

AppDomains and Dynamic Loading
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp05162002.asp

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
Hi Jan
Try to create a separate app domain and upload the assembly within that
application domain. (AppDomain.CreateDomain), then you can unload the
assembly by unloading its application domain (AppDomain.Unload).
Mohamed Mahfouz
 
Back
Top