我在一个使用 Havok 的项目上使用 VS2010,最新版本只有 VS2008 和更早的二进制文件。VS生成的嵌入式清单包含以下内容
<assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
由于显然 VS 从 2010 年开始不再使用并行程序集(source),因此我的 winsxs 目录没有安装调试 crt 程序集,并且 vs 可再发行包没有安装调试版本。如果我们编译使用带有嵌入式清单的 Havok 的 dll,加载 dll 的应用程序将无法启动。
我运行 sxstrace 并得到以下信息:
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at G:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
ERROR: Cannot resolve reference Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.
这些应用程序在我同事的一台机器上运行,因为(大概)他安装了 VS2008,但不是在另一个同事或我的机器上,因为我们只安装了 VS2010。工作机器在 winsxs 目录中的唯一 debugcrt 文件是
x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb
作为包含 dll、.manifest 文件和 .cat 文件的文件夹(相同的 publicKeyToken 但不同的版本)
我尝试将文件复制到我的 winsxs 目录,但没有解决问题。将 dll 直接放入包含二进制文件的目录中也无济于事。将文件放入bin\Microsoft.VC90.DebugCRT.DLL
(因为这是根据 sxstrace 搜索的目录之一)也没有帮助,但 sxstrace 的输出更改为
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at G:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT.DLL.
INFO: End assembly probing.
ERROR: Activation Context generation failed.
(它停止搜索,并且能够解析引用,但上下文生成仍然失败)
唯一有效的是禁用嵌入式清单生成。有没有其他方法可以解决这个问题?