net-Standard2.0是否可以替代AppDomainSetup和CreateInstanceAndUnwrap

时间:2019-02-07 14:31:32

标签: c# appdomain .net-standard .net-standard-2.0 appdomainsetup

我正在尝试让我的代码在netStandard2.0中编译,无法克服这一点。支持AppDomain,但方法受到限制。并且不支持AppDomainSetup。我有以下代码现在与Net Framework 4.7.1兼容。有没有其他选择可以使其在NetStandard2.0上编译??

AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = m_ApplicationBase;
setup.PrivateBinPath = m_PrivateBinPath;

setup.ApplicationName = "TemplateCompiler " + m_AppDomainCount;
setup.LoaderOptimization = LoaderOptimization.SingleDomain;
m_AppDomain = AppDomain.CreateDomain("TemplateCompiler Appdomain " + 
m_AppDomainCount, null, setup);
m_AppDomain.AssemblyResolve += AppDomainAssemblyResolve;

m_RemoteLoader = (RemoteLoader) m_AppDomain.CreateInstanceAndUnwrap 
(Assembly.GetExecutingAssembly().FullName, typeof(RemoteLoader).FullName);

0 个答案:

没有答案