【发布时间】:2011-03-29 17:11:57
【问题描述】:
我有一个使用 .NET 4.0 构建的项目。我有很多代码转换回 2.0 会很痛苦。
我尝试导入使用 .NET 2.0 构建的 Dll。一切正常,直到我尝试从该 DLL 执行代码。它说它无法加载指定的模块或其依赖项之一
我使用了 dumpbin.exe 来检查它可以有哪些依赖项
File Type: DLL
Section contains the following imports:
mscoree.dll
402000 Import Address Table
4057F0 Import Name Table
0 time date stamp
0 Index of first forwarder reference
0 _CorDllMain
所以我的猜测是 dll 尝试加载,但找不到 2.0 版的 mscoree.dll 并因此引发异常。
我尝试手动加载我的目标模块
Assembly asm = Assembly.LoadFrom(dllPath);
Visual Studio 调试器现在将模块列为已加载,但仍无法访问它。 Windows 搜索报告了几十个“mscoree.dll”分散在 c:\windows 目录中的任何地方,所以我对手动加载它有点怀疑。
【问题讨论】:
标签: c# .net assemblies linker version