开发者

How should I load assemblies across the application domain boundary to load and unload modules?

开发者 https://www.devze.com 2023-01-21 04:44 出处:网络
I\'m aware of the limitations of loading an assembly dynamically during run-time that prevents it from being unloaded.Instead it\'s been suggested that, if this is a requirement, that I should instead

I'm aware of the limitations of loading an assembly dynamically during run-time that prevents it from being unloaded. Instead it's been suggested that, if this is a requirement, that I should instead load modules in other application domains and then execute code across the domain bound开发者_如何学Pythonries.

How can I ease this development process and work with this scenario? What tools or frameworks are available?


Does MEF [1] send you in the right direction? Or you could go with Castle Windsor [2], though I've not had a need to unload with either.

[1] http://code.msdn.microsoft.com/mef

[2] http://www.castleproject.org/container/index.html


It depends on how complicated the interaction is between your "host" app and the dynamically loaded code. If it is fairly complicated then you may want to go the full System.AddIn route. If your interactions are fairly simple then you should probably just write your own classes to handle the loading and unloading of the assemblies. I've done this a number of times for various smaller projects so I can post code if that would be helpful.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号