问题描述
我在 2 个不同的目录中有一个 exe 和 dll
- Exe -
\\Drive\PathA\
- DLL -
\\Drive\PathB\
exe 动态加载 dll 并调用导出的函数。 导出的函数然后尝试创建域
var setup = new AppDomainSetup
{
ApplicationName = "NameOfDll",PrivateBinPathProbe = @"\\Drive\PathB\",ApplicationBase = @"\\Drive\PathB\"
};
var domain = AppDomain.CreateDomain(
"Name",AppDomain.CurrentDomain.Evidence,setup
);
domain.AssemblyResolve += OnAssemblyResolve; // <<< -- throws FileNotFoundException
“FileNotFoundException”是针对 dll 本身的!!
如果我将 dll 移动到 \\Drive\PathA\
,(exe 的路径),那么它工作正常。
我也试过 AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;
但这也不起作用,(OnAssemblyResolve
从未被调用)。
遗憾的是,我无法移动 dll 或 exe。但我可以控制 exe 和 dll 的代码。
那么,我该如何解析这个 dll 的路径,以便我可以创建一个域??
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)