Visual Studio 如何在 C++ 的清单文件内创建程序集引用项目?
我有一台新安装的开发计算机,运行 Windows 7 和 Visual Studio 2010 Service Pack 1。
在我们的解决方案中,我们有一个由多个应用程序使用的 C++ DLL。
在发布配置中,一切正常,但在调试配置中,当我尝试运行其中一个应用程序时,我收到错误对话框,指出应用程序无法正确启动。
我发现这是我们的 C++ DLL 中的 SxS 配置的问题。由于某种原因,DLL 的清单包含以下引用:
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
并且我的计算机上没有安装 VC90 运行时库的调试版本。
由于我们之前遇到过一些类似的问题,因此我们始终确保我们使用的外部库是使用与我们用于开发的相同 VS 版本编译的。
但看起来某处有对 VC90 DebugCRT 的引用。我试图在我们的外部库上使用 Dependency Walker 和 PeStudio 来解决这个问题,但我在任何地方都找不到任何对 VC90 DebugCRT Dll 的引用。
实际上,我通过在 Dll 的链接器设置中禁用清单文件的生成来解决了这些问题。因此,应用程序运行实际上不需要 VC90 DebugCRT,但无论如何都会引入它。
我现在只是想知道 VS 如何在构建过程中确定将哪些引用包含到清单文件中以及如何诊断该引用来自何处?
I have a freshly installed development machine with Windows 7 and Visual Studio 2010, Service Pack 1.
In our solution we have a C++ DLL which is used by several applications.
In the Release configuration everything works fine but in Debug configuration I get the error dialog that the application was unable to start correctly when I try to run one of the applications.
I figured out that it is a problem with the SxS configuration in our C++ DLL. For some reason the manifest of the DLL contains the following reference:
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
And there is no Debug version of the VC90 runtime libraries installed on my machine.
Since we had some similar problems before we always make sure that the external libraries we are using are compiled with the same VS version we use for development.
But it looks like there is a reference to the VC90 DebugCRT somewhere. I tried to figure it out using Dependency Walker and PeStudio on our external libraries but I could not find any reference to the VC90 DebugCRT Dll anywhere.
I actually fixed the issues by disabling the generation of the manifest file in the linker settings of our Dll. So the VC90 DebugCRT is actually not required for the application to run but pulled in somehow anyway.
I just was wondering now how VS determines during the build process which references to include into the manifest file and how can I diagnose where this reference comes from?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先检查您所依赖的应用程序和库的典型问题,例如“属性/C++/代码生成/运行时库”以及“_DEBUG”未定义。如果没有找到它,请打开详细链接“链接器/常规/显示进度”,看看它是否告诉您它在调试 crt 中寻找什么。
Check the typical issues first, such as "Properties/C++/Code Generation/Runtime lib" and that "_DEBUG" isn't defined, for both application and libs you depend on. If that doesn't find it, turn on verbose linking "Linker/General/Show Progress" and see if that tells you what it's looking for in the debug crt.