So i've been searching this for quite a while now, to no avail! Has anyon开发者_如何学Ce figured out how to change the $(WindowsSdkDir) macro in visual studio 2010, to make it point to whatever version of the windows sdk they would like?
Hopefully this can be a reference to all those who will search for this after me. :)
To tailor an individual Visual Studio 2010 project to use a specific version of the Windows SDK go to Project | Properties, select the General tab (under Configuration properties) and then set the "Platform Toolset" drop down to point at the SDK you want to use. The WindowsSdkDir macro will change appropriately.
Remember to make this change for all Configurations and all Platforms.
I ran into a similar problem when trying to setup a fresh system using VS2010 and the Windows 7 / .NET 4 SDK (v7.1). The solution turns out to be similar to the one for Visual Studio 2008, but in a different registry location. You want to apply the same edits, but the location is
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
for 32b Windows and
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows
for 64b Windows.
Also, depending on your installation (for both 32b and 64b versions of Windows), you may also need to change the corresponding key in the HKEY_CURRENT_USER
tree.
You want to edit the following keys to point to the SDK version you want to use:
CurrentInstallFolder
CurrentVersion
ProductVersion
After making the changes, I restarted Visual Studio and it used the appropriate SDK version. I don't know if this is a bug in the SDK installer (one was logged for the WindowsSDK v6.1, but none for v7.1) or if it is by design, but everything seems to compile correctly after my changes.
Tested for 32b and 64b Windows 7.
[HKEY_CURRENT_USER\Software\Microsoft\Microsoft SDKs\Windows]
"CurrentInstallFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\"
Note that, in contrast to the other registry locations, here actually no sub-key for 7.1 might exist. Don't be confused Visual Studio 2008 is searching here anyways.
精彩评论