Search code examples
c#mefautofac

Is there a .NET IoC container that can load and unload assemblies


I'm beating my head against the wall trying to find a container that will accomplish this.

What I'd like to do is have a AS.NET website running and not unload / recycle the AppDomain when I deploy a new or updated business rule contained in an assembly. This implies that the folder is outside of the bin folder, and preferably above it, not under it (although I can live with that). The closet I've come to this so far is using Autofac and MEF, but it seems like there's no way to unload a previously loaded assembly.

Anybody have any resources they can point me to?

Thank you, Stephen


Solution

  • No, there is not. Because it is not possible to unload an assembly, only a total appdomain. THis is a .NET runtime limitation - and as every .NET IOC container has to live in the .NET runtime it can not bypass it.

    If your imports are big enough isolating them in separate appdomains may be a good and viable idea.