Problem With Assembly.Load

  • Thread starter Carlos J. Quintero [.NET MVP]
  • Start date
C

Carlos J. Quintero [.NET MVP]

Hi Ram,

No, once an assembly is loaded into an appdomain, it can not be unloaded,
you must destroy the appdomain (i.e., close the application). But you can
load the assembly into a secondary appdomain:

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
 
R

Ram

Hey,
I have a windows application that uses Assembly.Load to get information on
certain Assemblies.
But the problem is, that after the Load, even after I clean the object (set
it to null), I cant access (physically) the assembly I loaded - I keep
getting:
"The Process Cannot Access The File Because It Is Being Used By Another
Process".
And nothing I do realease the assembly, - the only thing that works is to
close the application lol...
Is there a way to release the loaded assembly?
Thanks ahead

--Ram
 
H

Herfried K. Wagner [MVP]

Ram said:
I have a windows application that uses Assembly.Load to get information on
certain Assemblies.
But the problem is, that after the Load, even after I clean the object
(set
it to null), I cant access (physically) the assembly I loaded - I keep
getting:
"The Process Cannot Access The File Because It Is Being Used By Another
Process".
And nothing I do realease the assembly, - the only thing that works is to
close the application lol...
Is there a way to release the loaded assembly?

You'll have to work with a secondary AppDomain and remote interfaces:

<URL:http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm>
-> "Understanding how .Net loads code"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top