【发布时间】:2014-12-16 01:02:33
【问题描述】:
我有一个大型 Web 应用程序项目,包括 C#、C++ 和 C 中的代码,有许多引用(项目引用、DLL 引用),我正在制作发布版本。在虚拟机中测试我的程序出现以下错误:
Could not load file or assembly <MyAssembly.DLL> or one of its dependencies.
The application has failed to start because its side-by-side configuration is incorrect.
Please see the application event log or use the command-line sxstrace.exe tool for more detail.
所以我检查了事件日志,我发现:
Activation context generation failed for "C:\Windows\Microsoft.NET\Framework\...\MyAssembly.DLL".
Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",
publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
could not be found. Please use sxstrace.exe for detailed diagnosis.
我还按照建议使用了 sxstrace,最后得到了一个文件,上面写着:
ERROR: Cannot resolve reference Microsoft.VC90.DebugCRT,processorArchitecture="x86",
publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
我检查了我的项目的配置,它们都设置为内置版本。为什么 MyAssembly 引用 Microsoft.VC90.DebugCRT?我该如何解决?
请注意,我确实在我的虚拟机上安装了 x86 和 x64 MSVC++ 可再发行组件。
编辑 我还在 MyAssembly.dll 上运行了dependency walker,我得到了一堆说“打开文件时出错。系统找不到指定的文件”的条目:
API-MS-WIN-... (4x)
EXT-MS-WIN-...
MSVCM90D.DLL
MSVCR90.DLL
MSVCR90D.DLL
IESHIMS.DLL
MFPLAT.DLL
SETTINGSYNPOLICY.DLL
WLANAPI.DLL
【问题讨论】:
-
依赖步行者? dependencywalker.com
-
您在调试配置中拥有使用 VS2008 构建的 C 或 C++ 代码。如果您真的不知道您链接的 .lib 文件来自哪里,就会发生这种情况。我们当然也不会。您可以使用十六进制查看器查看 .lib 文件并搜索字符串以缩小范围。
-
@DmitriSosnik 我用depends的输出更新了问题。
-
@HansPassant,是的,我认为发生了这样的事情。只是完全不确定如何解决这个问题。我想我会听从你的建议的。
-
在dependency walker中,查看模块列表,找到MSVCR90D.dll,右击并选择`Highlight Matching Module in Tree"。这应该可以让你看到什么exe或dll需要这个模块。
标签: c# event-viewer