C # Loading / unloading plugins

In any case, there are ClassLibrary plugins that can be loaded / unloaded. The only way I found is to use the AppDomain, but that defeats the goal, as the plugin cannot use the host API.

+3
source share
3 answers

Yes, I did it with 1.1 2.0 and 3.5. Plus MS now has the MEF, which you probably want.

http://msdn.microsoft.com/en-us/magazine/ee291628.aspx

+3
source

: " API ", , -? , , , / . API- , API , , -:

Plugin -> PluginLib <- Host

API / , API. , . AppDomain / .

+1

CLR Appdomain, . .

This means that you can insert an instance of a type from assembly A into a new appdomain, where it loads Assembly B. B can then use the instance from assembly A to talk to the main appdomain. Until you pass any types from assembly B 'along the border', you can unload appdomain and delete assembly B from memory.

Take a look at MarshalByRefObject for more information on passing instances across AppDomain boundaries

+1
source

All Articles