This article applies to the Windows SDK for Windows Server 2008 and .NET Framework 3.5, when used with Visual Studio 2008 (all versions).  This post describes a problem with the GUI version of the Windows SDK Configuration Tool, which is used to set the version of Windows SDK headers, libraries and tools you wish to build with in Visual Studio.   This article applies only to Visual Studio 2008, and does not apply to those using the Windows SDK with Visual Studio 2005. This article does not apply to the command line version of the Windows SDK Configuration Tool.

 

Issue: The Windows SDK Configuration Tool (GUI mode) appears to update Visual Studio 2008 header, library and executable directories, but directories are not updated.  Users may not be aware of this because the SDK Configuration Tool returns a message saying that directories have been successfully updated.  The user may then build applications using an unexpected set of headers, libraries and tools.

 

Scenario: A user has Visual Studio 2008 (any SKU) installed on her computer, and also has the Windows SDK for Windows Server 2008 and .NET Framework 3.5 installed.  The user knows she can use the Windows SDK Configuration Tool to tell Visual Studio 2008 which version of the Windows SDK to use:  the Windows SDK components that ship in Visual Studio 2008, or the Windows SDK components installed with the standalone Windows SDK for Server 2008.

 

The user runs the Windows SDK Configuration Tool and changes the “current” SDK.  The tool returns a message saying the “Windows SDK Configuration Tool successfully set version X as the current version for Visual Studio 2008.”  In fact, the “current version” of the SDK has not been reset.

 

The cause: After installing the Windows SDK for Windows Server 2008 and Visual Studio 2008 (any SKU), you’ll have two sets of SDK resources installed by default to C:\Program Files\Microsoft SDKs\Windows\:

·             \v6.0A contains the SDK resources installed by Visual Studio 2008

·             \v6.1 contains the SDK resources installed by the Windows SDK for Windows Server 2008

When a Windows SDK (including the Windows SDK embedded in Visual Studio 2008) is installed, it writes the “currentInstallFolder" value in both of the following keys:

·         HKEY_CURRENT_USER\Software\Microsoft\Microsoft SDKs\Windows\

·         HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SDKs\Windows\

Visual Studio 2008 looks to these keys to determine the “current” SDK.  Visual Studio 2008 IDE first checks the HKCU key, and if that key is missing, it will look next in HKLM.  However, the Windows SDK Configuration Tool only updates the HKLM key:

·         HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SDKs\Windows\

Two workarounds are available.  Start the Windows SDK Configuration Tool in command line mode, or Update  HKEY_CURRENT_USER in the registry to point to the version of the SDK that you wish to build with.

 

Workaround option 1 (recommended): Start the Windows SDK Configuration Tool in command line mode:

1.       Launch Visual Studio 2008 command prompt

2.       CD to the directory where the SDK Configuration Tool is located (by default, C:\Program Files\Microsoft SDKs\Windows\v6.1\Setup).

3.       Run the SDK Configuration Tool, specifying which SDK version to make current: (Type:  WindowsSdkVer.exe -version:v6.1)

4.       You can now build at the command line using version v6.1 of the SDK

5.  If you’d like to build in the Visual Studio IDE, while still in the Visual Studio command window, type: devenv /useenv

6.       The SDK version you have set as “current” will remain the current SDK for the current Visual Studio session.

Workaround option 2: Update  HKEY_CURRENT_USER to point to the version of the SDK that you wish to build with:

(Modifying the registry is only recommended for advanced users, but if you have sufficient experience, you can update the  HKEY_CURRENT_USER to point to a different version of the SDK.  Anyone considering this should review the article, Windows registry information for advanced users before using regedit

This workaround is to update the "CurrentInstallFolder" value in HKEY_CURRENT_USER\Software\Microsoft\Microsoft SDKs\Windows\ and set it to the SDK you wish for Visual Studio 2008 to use. (Installation directories shown here are default installation paths. If you chose to install the SDK to a non-default location your path will be different.)

 

·         HKEY_CURRENT_USER\Software\Microsoft\Microsoft SDKs\Windows\@CurrentInstallFolder = C:\Program Files\Microsoft SDKs\Windows\v6.0A\ to build with the Windows SDK content included in VS2008;

 or

·         HKEY_CURRENT_USER\Software\Microsoft\Microsoft SDKs\Windows\@CurrentInstallFolder = C:\Program Files\Microsoft SDKs\Windows\v6.1\ to build with the Windows SDK content included in the Windows SDK for Server 2008.

 

The MSDN Windows SDK Developer Center is the place to find resources and links to Windows SDK products, release notes, technical articles, and more.