How to UnRegAsm and Delete an Assembly in the same program ?

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

Guest

I need to UnRegAsm and Delete an Assembly in the same .net program.
UnegAsm'ing is easy, just use the method 'UnregisterAssembly' from class
'System.Runtime.InteropServices.RegistrationServices'.

But to use 'UnregisterAssembly' method you need to load the Assembly to be
unregistered and when trying to delete the assembly using
'System.IO.File.Delete' I get the error:

Access to the path "..\MyAssembly.dll" is denied.

Researching the problem I read in the web that a loaded Assembly is not
released until its application ends. Is there a way to 'manually' release the
assembly ?

I've read something about creating another AppDomain but it seems very
complicated...

Could somebody help me ? thanks
 
Back
Top