Integrating Windows SDK and VS with new SDK Configuration tool



This article describes the use of the Windows SDK Configuration tool, which is included in the Windows SDK for Windows Server 2008 and .NET Framework 3.5 and works with Visual Studio 2005 and Visual Studio 2008, including Visual Studio 2008 Express SKUs.


A serious bug has been discovered with the Windows SDK Configuration Tool.  This bug is not apparent as the tool appears to work correctly.  Please read the blog post WinSDK bug notification: SDK Config Tool appears to work but fails, to learn more about the issue and find workaround steps.


 


What is the Windows SDK Configuration tool for?


The Windows SDK for Windows Server 2008 and .NET Framework 3.5, released in February, 2008, includes a new tool to help you develop more easily with Visual Studio.  You can use this tool to set which version of Windows SDK headers, libraries and tools you want to build with in Visual Studio.


 


 The Visual Studio 2008 editions are seamlessly integrated with the Windows SDK.  VS2008 editions include the same Vista RTM headers and libraries that shipped in the Microsoft Windows Software Development Kit Update for Windows Vista released in March, 2007. (The SDK tools in VS2008 are more recent.)  You can use these integrated Windows Vista headers and libraries right out of the box with Visual Studio 2008.   If you want to use the content in another Windows SDK, the SDK Configuration Tool will allow you to do just that, by setting which SDK is the ‘current’ SDK to build with. 


 


Updating the Windows SDK Content in Visual C++2008


You can build Win32 applications right out of the box with the Vista RTM SDK components that are embedded in Visual Studio 2008.  It’s also easy to switch to the more recent components that ship with the Windows SDK for Windows Server 2008 and .NET Framework 3.5 by installing this SDK on your computer.  If you install the SDK after you installed VS, you are ready to develop with the headers, libraries and tools in the SDK for Windows Server 2008.  If you installed the Windows Server 2008 SDK before you install Visual Studio, you will need to use the SDK Configuration Tool to set the directories. 


sdkconfigTool - Share on Ovi


Windows SDK headers, libraries and tools 


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


 Directory - Share on Ovi


Visual Studio 2008 will point to v6.0A headers, libraries and tools, which installed with VS by default.  Use the SDK Configuration Tool to update the Visual C++ directories to point to the v6.1 headers, libraries and tools that shipped with the Windows SDK for Server 2008.


 


How does the SDK Configuration Tool work?


The tool works by altering the Visual Studio 2008 directories through a registry key setting.  (The tool works differently with Visual Studio 2005. This will be covered in a future post.)


 


·         On an X86 computer: HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows


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


The settings “CurrentVersion” and “CurrentInstallFolder” refer to the version and location of the registered Windows SDK headers, libraries and tools. These settings get updated during Windows SDK installation or when the Windows SDK Configuration Tool is used to choose which Windows SDK content users want to use with Visual Studio 2008.  


 


SDK registry settings used by Visual Studio 2008 - Share on Ovi


 

















SubKey


Window SDK Version


V6.0


Windows SDK for Windows Vista and Windows SDK for Windows Vista Update


V6.0A


Windows SDK Visual Studio Components


V6.1


Windows SDK for Windows Server 2008


 


Visual Studio 2008 looks at this key to determine how to set the following directories:


 


·         Visual Studio Library Directory sets the paths to use when searching for library files while building a VC++ project.  It corresponds to environment variable LIB. 


·         The Visual Studio Include Directory sets the paths to use when searching for include files while building a VC++ project.  It corresponds to environment variable INCLUDE. 


·         The Visual Studio Executables Directory sets the path to use when searching for executable files while building a VC++ project.  It corresponds to environment variable PATH.


The VC++ 2008 Library, Include and Tool path are set upon install to the Windows SDK content that ships embedded with Visual Studio 2008.  If you want to change these paths you can do so manually through Visual Studio, or use the SDK Configuration Tool to set these directories. 


 


  VCInclude Dir - Share on Ovi


The SDK Configuration Tool has a GUI interface that works with the Visual Studio Retail (non-Express) SKUs, and a command line interface that works with either the VS Retail or Express SKUs.  (See Using Visual C++ 2008 Express with the Windows SDK  for more information on working with Visual Studio Express.)


 


How to use the SDK Configuration Tool in GUI mode


To launch the SDK Configuration Tool GUI interface, go to Start, All Programs, Microsoft Windows SDK v6.1, Visual Studio Registration, Windows SDK Configuration Tool.


launchSDKconfig - Share on Ovi


Use the drop box to pick which version of SDK content you want to integrate with Visual Studio, and click Make Current. 


 sdkconfigTool - Share on Ovi


How to use the SDK Configuration Tool at the command line


The SDK Configuration Tool can be used with either the GUI or command line interfaces with Visual Studio 2005 Retail or Visual Studio 2008.  The tool can only be used at the command line for Visual Studio 2008 Express SKUs. (See Using Visual C++ 2008 Express with the Windows SDK.)


 


1.       Launch the Windows SDK Command Window (Start, All Programs, Microsoft Windows SDK v6.1, Command Window)


2.       CD to \Program Files\Microsoft\Windows\v6.1\Setup>


3.       Type:  WindowsSdkVer.exe -version:v6.1


 


This will set the Windows SDK for Windows Server 2008 (v 6.1) as the “current” SDK for Visual Studio to use for headers, libraries and tools. 


SDKcmdWindow - Share on Ovi


CMDwinConfirm - Share on Ovi


How to validate that Visual Studio Directories were successfully updated


 


Open the Visual Studio command window and check the PATH to see if the v6.1 directory has been added:


1.            Start, All Programs, Visual C++ Express Edition 9.0, Visual Studio Tools, Visual Studio 2008 Command Prompt


2.           At the prompt, type: PATH


verify - Share on Ovi


How to Switch back to the SDK content that shipped ‘in the box’ with Visual Studio 2008


To restore the default directories, use the SDK Configuration Tool at the command line to make the v6.0A directories ‘current.’


 


1.            Launch the Windows SDK Command Window (Start, All Programs, Microsoft Windows SDK v6.1, Command Window)


2.            CD to \Program Files\Microsoft\Windows\v6.1\Setup>


3.            Type:  WindowsSdkVer.exe -version:v6.0A


 Troubleshooting:


 


After Visual Studio Repair, environment variables are reset.  If Visual Studio is Repaired (through Add/Remove Programs), the environment variables will point back to the default VS content.  You will need to use the SDK Configuration tool if you want to point to the content in the Windows Server 2008 SDK.


 


After Windows SDK Repair, environment variables are reset. If the Windows SDK is ‘Repaired’ (through Add/Remove Programs), the environment variables will point to Windows SDK content.  You will need to use the SDK Configuration tool if you want to point to the content that shipped with Visual Studio 2008.


 


Please send feedback on this tool. 


 


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

Comments (18)

  1. This article describes what you need to do to build Win32 applications using Visual C++ Express and the

  2. You’ve been kicked (a good thing) – Trackback from DotNetKicks.com

  3. If you have Visual Studio 2008 you can build VC++ applications right out of the box with the embedded

  4. The Windows SDK for Windows Server 2008 and .NET Framework 3.5 , released in February, 2008, includes

  5. Today is download day at MSDN. There are some very interesting things published. New release of Windows

  6. PatriotB says:

    Hmm… the latest SDK is versioned 6.1?  That’s too bad.

    I remember that prerelease versions of the Windows SDK for Vista were initially labeled as "v1.0" (installed in a v1.0 folder), but after several people (such as myself) pointed out that Vista is Windows 6.0, the SDK was wisely changed to be labeled as v6.0.

    I then saw some mentions of a "v6.0A" floating around and thought that this was the labeling for the VistaSP1/Server2008 SDK, since those OSes are Windows 6.0 SP1.  Unfortunately, I’ve found out (as this article confirms) that 6.0A is really some VS-specific SDK, and that the VistaSP1/Server2008 SDK was released as v6.1.

    It’s unfortunate since after taking a specific step to align the version numbers, you’re off already.  Especially since it’s looking like Windows "7" is actually version 6.1; what will the SDK for that OS be versioned?

  7. JDalal says:

    Thanks for posting this. I used the configuration tool to set the SDK version to v6.1. I verified that the PATH environment variable in VS 2008 cmd window as well as HKLMSWMSMSSDKWindows points to v6.1. However, when I try to build an application, I still see that it is picking up the include directory from v6.0A. I added /showIncludes compiler flag and it shows that the header files are being picked up from v6.0A and not v6.1, which is what I want. Can you please help?

  8. JDalal says:

    Ok I think I found the fix. I think, the sdk configuration tool modifies the HKLM value. But for some reason if the corresponding HKCU value was set, the VS2008 picks that value up and before reading the HKLM value. VS command line correctly looks at the HKLM value (I guess it reads from vcvars32.bat).

    I just modified HKEY_CURRENT_USERSoftwareMicrosoftMicrosoft SDKsWindowsCurrentInstallFolder to point to v6.1 install folder and VS picked it up.

  9. wsdkblog@microsoft.com says:

    JDalal, I’ve sent you an email with a few questions.  We’re researching this issue and trying to repro it now.  There is a known issue with the SDK Configuration Tool with XP, with a workaround posted here: http://blogs.msdn.com/windowssdk/archive/2008/03/07/workaround-sdk-build-env-fails-on-x86-xp-with-vs2005.aspx

    Karin Meier

    Windows SDK Team

  10. This article applies to the Windows SDK for Windows Server 2008 and .NET Framework 3.5 , when used with

  11. The Windows SDK Configuration Tool sets which version of Windows SDK headers, libraries and tools you

  12. The Windows SDK Configuration Tool sets which version of Windows SDK headers, libraries and tools you

  13. The UI Spy tool did not ship in the Windows SDK for Windows Server 2008 and .NET Framework 3.5 , released

  14. [This blog was migrated. You will not be able to comment here. The new URL of this post is http://khason

  15. The Windows SDK for Windows 7 and .NET Framework 3.5 SP1: Beta has been released (ISO-format). As many

  16. Windows SDK for Windows 7 and .NET Framework 3.5 SP1 の詳細

  17. Larry says:

    Is there something like this tool for VS2010 and SDK 7.1? If run the cl.exe from the SDK command prompt (with /showIncludes) it uses the headers from the 7.1 SDK. But Visual Studio 2010 SP1 still uses the 7.0A headers.