Create application domain and load assembly

丶灬走出姿态 提交于 2019-12-02 09:34:53

You may take a look at the following article on MSDN. Or if you want to construct an instance of some type inside another AppDomain (assuming this type has a default constructor):

var domain = AppDomain.CreateDomain("NewAppDomain");
var path = @"C:\work\SomeAssembly.dll";
var t = typeof(SomeType);
var instance = (SomeType)domain.CreateInstanceFromAndUnwrap(path, t.FullName);

The instance variable returned with this method lives on your newly created application domain and you are ready to manipulate it.

sehe

Perhaps this helps

Can I reload an assembly in Mono CSharpRepl?

var dom = AppDomain.CreateDomain("tmp");
dom.Load("System.Core");
AppDomain.Unload(dom);

See also

Using multiple versions of the same DLL

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!