C # - Loading a .NET assembly into a separate AppDomain so you can unload it

Possible duplicate:
DLL loading into a separate AppDomain

What is the correct way to load a .NET assembly into a separate AppDomain so that you can access its types / classes, but you can still unload it (and reload).

This goes for this previous discussion: C # is the right way to load an assembly, find the class and call method ()

+6
reflection c # dynamic assemblies
source share
1 answer

Basically, you just create a new AppDomain and then call AppDomain.CreateInstanceAndUnwrap to create the type. Here's a simple CodeProject article on this process.

There are some tricks here. You can never reference Type directly (this will load this type into your current AppDomain), and all objects must be retrieved from MarshallByRefObj . This will allow you to use the object β€œremotely”, which means that it does not load into your AppDomain.

+3
source share

All Articles