Unable to load executing assembly into new AppDomain, FileNotFoundException

心已入冬 提交于 2019-12-08 19:57:27

Assumying your assembly is in the same directory as your current application base, try specifying Application Base:

        AppDomain.CreateDomain(templateDomainFriendlyName, null,
            new AppDomainSetup
            {
                ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase
            });

If you don't know what you are doing, the best way to create a new domain is to copy all settings from the current one, like this:

        var newDomain = AppDomain.CreateDomain("NAME", 
                        AppDomain.CurrentDomain.Evidence,
                        AppDomain.CurrentDomain.SetupInformation);

I had similar issues, and making a copy resolved them for me

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