简体   繁体   中英

Visual Studio 2012 Debug .exe Needs Microsoft.VC90.DebugCRT

When I build the debug configuration, the .exe fails to launch.

It reports

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.

I used the sxstrace.exe tool. It reports the following error:

ERROR: Cannot resolve reference Microsoft.VC90.DebugCRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".

I've read a lot of posts related to these side-by-side errors. I tried installing the Visual Studio 2008 redistributable packages hoping the missing debug .dll would be installed in C:\\Windows\\winsxs. However, I saw

Debug versions of applications and the various Visual C++ DLLs are not redistributable.

at https://msdn.microsoft.com/en-us/library/8kche8ah%28v=vs.110%29.aspx .

How can I resolve this issue?

Your manifest file for the debug build is incorrect. Here is what mine looks like for VS2013. Notice the "Require DEBUG CRT" option. Now to load this, in my RC file I have:

#ifdef _DEBUG
1 24 "profiler.exe.debug.manifest"
#else
1 24 "profiler.exe.manifest"
#endif

Here is the MyProgram.exe.debug.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

  <!-- Declare your Identity -->
  <assemblyIdentity type="win32" name="YOUR_COMPANY_NAME" version="1.0.0.0" processorArchitecture="*" />

  <!-- Require Common Controls version 6 -->
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/>
    </dependentAssembly>
  </dependency>

  <!-- Require DEBUG CRT -->
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="*" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>

  <!-- Declare support for Vista and Windows 7 -->
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    </application>
  </compatibility>

  <!-- Declare Privileges -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>

  <!-- Declare High DPI support -->
  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
      <dpiAware>true</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>

</assembly>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM