是否可以在Visual Studio 2008中正确嵌入清单文件?

时间:2010-03-17 22:45:59

标签: visual-studio-2008 manifest side-by-side winsxs sxs

我发现mt.exe无法在VCPROJ中运行时正确创建并将清单文件嵌入到可执行文件中。

例如,相同的可执行文件在Windows 7上加载良好,但无法在Windows XP上加载。清单是嵌入和正确的。

失败的地方是crtlib.c

if (!(*pfnFindActCtxSectionStringW)(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, _CRT_DLL_FILENAME, &askd))

这已将我发送至http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/2d6af19a-6ead-4c00-a896-871a28c5f7f1

我花了很多时间寻找可能的原因和解决方案我修改了项目设置以生成exe文件之外的清单。现在它适用于两个系统。

以下是调试版本的示例。

禁用嵌入:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86"     publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.DebugMFC" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>

启用嵌入时:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> 
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" /> 
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.DebugMFC" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" /> 
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*" /> 
</dependentAssembly>
</dependency>
</assembly>

如果你比较它们,第二个添加了公共控件(我不知道从哪里开始),并且它与requestedExecutionLevel标记的语法有一点不同。

现在的问题是,是否可以使mt.exe正确嵌入清单以及如何?

0 个答案:

没有答案