VS2013编译VS2010的CPP项目出错

前一阵子重装了电脑,很多编译环境都丢失了,各种悲剧不说,还有一些奇奇怪怪的错误

我以前有一个VS的项目,初始是2010sp1的VC本地项目,后来升级到VS2013
但一直没时间去处理兼容性问题,就没有将项目升级到2013的格式
相当于用2013在编译2010的工程,好在是相安无事。

现在重装了,我准备重新编译一下,结果VS2013告诉我Windows SDK配置错误

warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.

在网上找了很久,解决方法就两种,一是修改注册表,一是安装对应版本的SDK。
尝试了修改注册表,但没有效果,还是同样的错误。
由于时间很紧迫,一怒之下安装了VS2010+SP1,结果就好了。

现在的注册表为:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows]
"CurrentVersion"="7.1.51106"
"CurrentInstallFolder"="C:\\Program Files (x86)\\Windows Kits\\8.0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A]
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\"
"ProductVersion"="7.0.30319"
"ProductName"="Microsoft Windows SDK for Visual Studio 2010"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx35Tools]
"ProductVersion"="7.0.30319"
"ComponentName"="Windows SDK .NET Framework 3.5 Multi-targeting Utilities"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx35Tools-x64]
"ProductVersion"="7.0.30319"
"ComponentName"="Windows SDK .NET Framework 3.5 Multi-targeting Utilities (x64)"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\x64\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx35Tools-x86]
"ProductVersion"="7.0.30319"
"ComponentName"="Windows SDK .NET Framework 3.5 Multi-targeting Utilities"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools]
"ProductVersion"="7.0.30319"
"ComponentName"="Windows SDK Tools for .NET Framework 4.0"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\NETFX 4.0 Tools\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools-x64]
"ProductVersion"="7.0.30319"
"ComponentName"="Windows SDK Tools for .NET Framework 4.0 (x64)"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\NETFX 4.0 Tools\\x64\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools-x86]
"ProductVersion"="7.0.30319"
"ComponentName"="Windows SDK Tools for .NET Framework 4.0"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\NETFX 4.0 Tools\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-SDKTools]
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\"
"ProductVersion"="7.0.30319"
"ComponentName"="Windows Common Utilities"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-Win32Tools]
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\"
"ProductVersion"="7.0.30319"
"ComponentName"="Windows Utilities for Win32 Development"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-WindowsHeadersLibs]
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\"
"ProductVersion"="7.0.30319"
"ComponentName"="Windows Headers and Libraries"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-WinSDKIntellisenseRefAssys]
"InstallationFolder"="C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\mmc\\v3.0\\"
"ProductVersion"="7.0.30319"
"ComponentName"="Windows Intellisense and Reference Assemblies"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\"
"ProductVersion"="7.1.7600.0.30514"
"ProductName"="Microsoft Windows SDK for Windows 7 (7.1.7600.0.30514)"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools]
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Tools for .NET Framework 4.0"
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bin\\NETFX 4.0 Tools\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools-x64]
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Tools for .NET Framework 4.0 (x64)"
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bin\\NETFX 4.0 Tools\\x64\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools-x86]
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Tools for .NET Framework 4.0"
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bin\\NETFX 4.0 Tools\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKBuild]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Microsoft Windows SDK Headers and Libraries"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKIntellisenseNFX]
"InstallationFolder"="C:\\Windows\\Microsoft.NET\\Framework\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Microsoft Windows SDK Intellisense for .Net"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKIntellisenseRefAssys]
"InstallationFolder"="C:\\Program Files\\Reference Assemblies\\Microsoft\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Intellisense and Reference Assemblies"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKInterop]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Microsoft Windows SDK NetFx Interop"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKNetFx35Tools]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Microsoft Windows SDK NetFx 3.5 Tools"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKNetFx35Tools\1033]
"SP"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKNetFx35Tools-x64]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\x64\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Microsoft Windows SDK NetFx 3.5 Tools (x64)"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKSamples]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Samples\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Samples"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKTools]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Common Utilities"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKTools-x64]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\x64\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Common Utilities (x64)"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKWin32Tools]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Utilities for Win32 Development"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKWin32Tools-x64]
"InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\x64\\"
"ProductVersion"="7.1.7600.0.30514"
"ComponentName"="Windows SDK Utilities for Win32 Development (x64)"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1A]
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\"
"ProductVersion"="7.1.51106"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1A\XPSupport]
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\"
"ProductVersion"="7.1.51106"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A]
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.0A\\"
"ProductVersion"="8.0.50709"
"ServicingVersion"="8.0.50710"
"ProductName"="Microsoft .NET Framework 4.5 SDK"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx35Tools]
"ProductVersion"="8.0.50727"
"ComponentName"="Microsoft Visual Studio 2012 Multi-targeting Utilities for .NET Framework 3.5"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx35Tools-x64]
"ProductVersion"="8.0.50727"
"ComponentName"="Microsoft Visual Studio 2012 Multi-targeting Utilities for .NET Framework 3.5 (x64)"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\x64\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx35Tools-x86]
"ProductVersion"="8.0.50727"
"ComponentName"="Microsoft Visual Studio 2012 Multi-targeting Utilities for .NET Framework 3.5"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools]
"ProductVersion"="8.0.50709"
"ComponentName"="Microsoft .NET Framework 4.5 SDK"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.0A\\bin\\NETFX 4.0 Tools\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x64]
"ProductVersion"="8.0.50709"
"ComponentName"="Microsoft .NET Framework 4.5 SDK"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.0A\\bin\\NETFX 4.0 Tools\\x64\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86]
"ProductVersion"="8.0.50709"
"ComponentName"="Microsoft .NET Framework 4.5 SDK"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.0A\\bin\\NETFX 4.0 Tools\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1]
"InstallationFolder"="C:\\Program Files (x86)\\Windows Kits\\8.1\\"
"ProductName"="Microsoft Windows SDK for Windows 8.1"
"ProductVersion"="8.1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1A]
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\"
"ProductVersion"="8.1.51641"
"ProductName"="Microsoft .NET Framework 4.5.1 SDK"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools]
"ProductVersion"="8.1.51641"
"ComponentName"="Microsoft .NET Framework 4.5.1 SDK"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\bin\\NETFX 4.5.1 Tools\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools-x64]
"ProductVersion"="8.1.51641"
"ComponentName"="Microsoft .NET Framework 4.5.1 SDK"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\bin\\NETFX 4.5.1 Tools\\x64\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools-x86]
"ProductVersion"="8.1.51641"
"ComponentName"="Microsoft .NET Framework 4.5.1 SDK"
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\bin\\NETFX 4.5.1 Tools\\"

其实在此前,我已经安装了Windows SDK7.1,应该是可以编译的,不知道为什么。。。
当时时间紧迫,没能细究。
希望我现在的注册表配置,能给大家提供参考。。。

Leave a Reply

Your email address will not be published. Required fields are marked *

*