How to build with v90 platform toolset in VS2012 w

2020-02-03 06:51发布

问题:

I use Visual Studio 2012 and this is the only version of Visual Studio I have installed. I need to build certain C++ projects with the v90 platform toolset (of Visual Studio 2008), but I can't install Visual Studio 2008.

I understand it is possible to use the v90 platform toolset by installing Windows SDK 7.0. How exactly is it done? If I simply use the web installer of 7.0 SP1, I still don't see v90 as one of the possible platform toolsets.

回答1:

It is possible, but apparently requires some maneuvering and will not support building MFC applications. The following assumes that VS2012 update 4 is installed, but neither VS2010 nor VS2008 are installed.

  1. Download the x86 DVD of SDK 7.0 SP1 (GRMSDK_EN_DVD.iso). Mount the ISO or extract its contents, and manually install the MSI files from the following folders under the Setup folder:

    • WinSDK (this may fail, it's ok)
    • WinSDKBuild
    • WinSDKInterop
    • WinSDKTools
    • WinSDKWin32Tools
    • vc_stdx86
    • vc_stdamd64
    • winsdk_intellidocs
    • WinSDKIntellisenceRefAssys
    • WinSDKNetFxTools

     

  2. Download the x86 DVD of SDK 7.1 (GRMSDK_EN_DVD.iso). Mount the ISO or extract its contents, and manually install the MSI files from the same folders listed above (except winsdk_intellidocs, which doesn't exist).

  3. Go to C:\Program Files (x86)\Microsoft Visual Studio 9.0. Copy the following files from Common7\IDE to VC\bin:

    • msobj80.dll
    • mspdb80.dll
    • mspdbcore.dll
    • mspdbsrv.exe

Now you should be able to choose the v90 platform toolset in Visual Studio 2012 and build with it.

Explanations (and sources):

  • Individual MSI installation is based on the second workaround from this connect report.
  • The requirement for both 7.0 and 7.1 is based on this question (both VS2010 and VS2008 are required to use v90 in VS2012!). SDK 7.1 is not needed if you have VS2010.
  • DLL/EXE copying requirement is based on yet another question. If you do not copy them, you will see error MSB6006: "CL.exe" exited with code -1073741515.


回答2:

In addition to this answer I want to add that

  1. You can install SDK 7.0 simply by running setup, there is no problem with it.
  2. You can install SDK 7.1 by running setup, if you remove Microsoft Visual C++ 2010 Redistributables first and fix following registry values:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client]
    "Version"="4.0.30319"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full]
    "Version"="4.0.30319"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Client]
    "Version"="4.0.30319"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Full]
    "Version"="4.0.30319"
    

    You can (and probably should) restore these values to whatever they originally were after installation is complete.

    Do not forget to install KB2519277 after this, it updates compilers in SDK 7.1 to SP1.

  3. You don't need to copy any dll. MSBuild uses

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC@ProductDir
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Setup\VC@ProductDir
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS@ProductDir
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Setup\VS@ProductDir
    

    to set up paths. It's probably wise to fix them to point to "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\" and "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\" as it might be useful elsewhere in build process.

    Same goes for version 10.0 if you plan to use Windows7.1SDK toolset.

  4. Use WindowsSdkVer.exe to set current SDK to 7.1 to defeat cryptic error in Microsoft.Cpp.x64.Targets(63,5) about missing unnamed required file. If the tool gives you error, then set these values manually:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder
    

    to point to newly installed SDK. The tool needs some registry keys from Visual Studio installation to work properly, but there are many and I'm not sure which are important.

  5. Reboot. None of the above asks you to, but without reboot I got errors when trying to build a project.

  6. As an aside, SDK7.1 adds v100 toolset, but it won't work, saying something about Could not find WindowsSDKDir variable from the registry. This is because v100 actually requires SDK7.0A which comes with Visual Studio 2010 and is not available separately. Windows7.1SDK toolset is the one which utilises VC2010 compilers if you need them.

  7. Microsoft.Cpp.Win32.*.props files have a lot of relevant stuff if something fails in build system.



回答3:

One addition/update for VS2013 to Yodans answer:

My working setup:

  1. VS2013 has to use VS2010 libs
  2. Using WinSDK 7.1 (Yodans 2.) build tools (v100) in VS2013
  3. clean install, uninstalling everything mentioned in the sdk release notes (can be downloaded at http://www.microsoft.com/en-us/download/details.aspx?id=8279 under category Details)
    1. Microsoft Windows SDK for Windows 7 (7.1) (the Windows SDK core-component files)
    2. Application Verifier
    3. Debugging Tools for Windows
    4. Windows Performance Toolkit
    5. Microsoft Help Viewer 1.0
    6. Microsoft Visual C++ 2010 Redistributable
    7. Microsoft Visual C++ 2010 Standard Edition
    8. Additionally removed all .NET and VC++ related MS Software (not tested if necessary)
  4. choosing Windows7.1SDK as Platform Toolset in VS2013
  5. error MSB6006: "CL.exe" exited with code -1073741515
  6. cl.exe uses msobj100.dll, mspdb100.dll, mspdbcore.dll and mspdbsrv.exe
  7. Added to PATH C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
  8. Build works and binary is usable ( So now its tested Yodan ;-) )

My mistake:

  1. copied files in 7. above to C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin (Yodans 3.), believing this dir is in PATH, but it was not!
  2. So better do as sugested by Yodan and tested by myself in 8. above

p.s. same answer is solving this problem: Visual Studio 2013: CL.exe exited with code -1073741515