Workaround: MSBuild and/or VCBuild fail to find Win 7 SDK headers, libs and tools

This post applies to the RC release of the Windows SDK for Windows 7 and .NET Framework 3.5 SP1.

Scenario: if VS2008 or another Windows SDK is installed, MSBuild and/or VCBuild may default to the headers, libs and tools of the older SDK.   Samples or applications built in the SDK build environment or in Visual Studio 2008 IDE will fail to find the Windows 7 content. 

Cause: a change was made to the way the Windows SDK writes to the registry keys that VS2008 uses to determine the "current" SDK.  The Windows SDK for Server 2008, and earlier pre-releases of the Windows 7 SDK set a registry key upon installation:

  • On an X86 computer: HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows
  • On an X64 or IA64 computer: HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows

This key is used by the VC++ toolset in both Visual Studio 2008 and in the Windows SDK build environment.  A decisions was made for the Windows 7 SDK to no longer set this key during installation in order to avoid unexpected changes to Visual Studio 2008.

Workaround: use the Windows SDK Configuration Tool to set the Windows 7 SDK as the “current” SDK for MSBuild and VCBuild. This will update the Windows 7 SDK build environment and the Visual Studio 2008 IDE build environment to use the Windows 7 SDK content.  You can also use this tool to switch it back again.

To run the Windows SDK Configuration Tool, go to Start, All Programs, Microsoft Windows SDK v7.0, Visual Studio Registration, Windows SDK Configuration Tool.

Send your thoughts to the Windows SDK Feedback alias.  Tell us how you use the SDK and what we can do to improve your development experience.