Welcome to MSDN Blogs Sign in | Join | Help

Installing Win SDK for Svr 2008 after VS 2008 breaks VS command line build environment

Issue:  After installing the Windows SDK for Server 2008, you are no longer able to build at the VS2008 command line.  You receive an error that csc, vbc, and/or msbuild commands are not recognized.  You are able to build without problems in the VS IDE. 

 

Cause: The VC++ compilers that install with the Windows SDK overwrite vcvars32.bat improperly.

 

Workaround: Repair the VS2008 command line build environment by editing c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat manually.

 

 Close all instances of Visual Studio:

1.       Use Notepad to edit the file %\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat.  Change the top few lines where the variables are set.

 Change these lines:

@SET VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0
@SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0\VC
@
SET FrameworkDir=Framework32
@SET FrameworkVersion=v2.0.50727

@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR

 

to the following, in order to set the correct path to the frameworkdir:

@SET VSINSTALLDIR=c:\Program Files\Microsoft Visual Studio 9.0
@SET VCINSTALLDIR=c:\Program Files\Microsoft Visual Studio 9.0\VC
@
SET FrameworkDir=c:\Windows\Microsoft.NET\Framework
@SET FrameworkVersion=v2.0.50727
@
SET Framework35Version=v3.5

@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR

 

  1.  Open the VS command line build environment and verify that you can build successfully.  

 Please email us directly if you need additional help.

 

Karin Meier

Windows SDK Program Manager

 

Windows SDK Hidden Gems Part 2: XAMLPad

As the builder of the Windows SDK, I have a vested interest in what is delivered with the SDK.  I’m sharing some of the interesting jewels I've found in my series “Windows SDK Hidden Gems.”  In my last post I talked about the Windows Installer Verbose Log Analyzer (WiLogUtl.exe).

Technologies come and go.  Some show real promise, and others take the computing world by storm. XAML is one of the latter.  Working in concert with WPF (Windows Presentation Foundation is part of the .NET Framework), XAML greatly increases the options for designing interfaces used in the next generation of programs. One of the many programs that takes advantage of XAML is Silverlight. When used by Silverlight as a graphics description language, XAML opens the door to animation and rescaleable graphics and typefaces for interactive web sites.

This month’s hidden gem, XAMLPad.exe, encourages the user to play and experiment with XAML.  It’s great for testing out the many XAML samples available on the net and in the Windows SDK.  XAMLPad is installed with the Windows SDK .NET Framework Tools component and can be found from the Start menu at All Programs/Microsoft Windows SDK/Tools/XAMLPad.

As with any new acronym there’s the question, “How do you pronounce that one?”  In this case, XAML rhymes with camel.

clip_image001

Here’s a screenshot of a quick sample done after about an hour poking around with the WPF documentation and the XAML overview. The sample code is available below.

A few quick notes about XAMLPad

  • In order to run XAMLPad you will need the .NET Framework 3.0 or later installed on your computer. This is included in the Vista operating system.
  • XAMLPad allows viewing the XAML code several different ways, such as a visual tree hierarchy.
  • Right clicking in the edit pane brings up a snippets menu for commonly used code.
  • To open a specific file, it must be specified on a command line.
  • There is no file menu. When the code entered passes validation, it is saved to a XAMLPad_Saved.XAML file.

Here is the sample code for the image above. It can be copy/pasted in its entirety.

  <Page xmlns="http://schemas.microsoft.com/winfx/2006/XAML/presentation"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/XAML" >
  <Grid>
    <Canvas Height="200" Width="200">
      <Ellipse Width="200" Height="200"
        Fill="Yellow"
        Stroke="Black" StrokeThickness="4"
        Canvas.Left="10" Canvas.Top="10"/>
      <Ellipse Width="10" Height="10"
        Fill="Black"
        Canvas.Left="60" Canvas.Top="75" />
      <Ellipse Width="10" Height="10"
        Fill="Black"
        Canvas.Left="150" Canvas.Top="75" />
      <Path Stroke="Black" StrokeThickness="4"
        Data="M 60,130 C 60,190 160,190 160,130" />
    </Canvas>
  </Grid>
</Page>

hopefully, this will get you started in the world of XAML. I’m off to find more gems to present.

Cheers,
Curtis

Windows SDK Builder

Workaround: SDK build env fails on X86 XP with VS2005

This article applies to the Windows SDK for Windows Server 2008 and .NET Framework 3.5Problem:  If your usage scenario matches the one listed below, you will be unable to build in the Windows SDK command line build environment.  If you type cl.exe in the SDK command window and press Enter, you will see this error:

 

This application has failed to start because mspdb80.dll was not found.  Re-installing the application may fix this problem.

 

Computer setup required to repro issue:

 

1.       Windows XP on x86 machine (which has version 5.1.2600.2180 of REG.exe)

2.       Visual Studio 2005 installed, but Visual Studio 2008 is NOT installed

 

Cause: When the SDK build environment window is launched, the SDK file SetEnv.cmd launches Reg.exe.  Reg.exe generates standard output when a valid KeyPath is specified and also generates error output when invalid Value is specified.  In this scenario, the KeyPath is valid but the value doesn’t exist:

 

Command:

REG QUERY "%VSRegKeyPath%" /v 9.0

 Output:

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VC7

 Error:  The system was unable to find the specified registry key or value

 

The second call to REG in setenv.cmd is grabbing the output from the call above and setting VSRoot=VERSION 3.0, which breaks the Windows SDK build environment.  (Other versions of REG.EXE will immediately throw an error when an invalid KeyPath/Value combination is specified.)

 

Workaround: follow these instructions to manually edit SetEnv.cmd to remove the second call to REG:

 

  1. Open up SetEnv.cmd in Notepad or another editor.
  2. For this line:

FOR /F "tokens=2* delims=  " %%A IN ('REG QUERY "%VSRegKeyPath%" /v 9.0') DO SET VSRoot=%%B

Either comment out using the REM command (like this):

REM FOR /F "tokens=2* delims=     " %%A IN ('REG QUERY "%VSRegKeyPath%" /v 9.0') DO SET VSRoot=%%B

 

OR delete the line completely.

  1. Save SetEnv.cmd.
  2. Restart the Windows SDK command prompt.

||Karin Meier||Windows SDK PM||Build Environment.Samples.Community||

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.

 

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\:

·         \6.0A contains the SDK resources installed by Visual Studio 2008

·         \6.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. 

Speech Content in the Windows SDK

Charles Oppermann on the Speech team wrote a post on the new Speech-related content that ships in the recently released Windows SDK for Windows Server 2008 and .NET Framework 3.5.  The content in this new Windows SDK completely replaces the older SAPI 5.1 SDK and supports development on Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008.

 

Posted by wsdkblog@microsoft.com | 0 Comments
Filed under: , ,

Workaround: Installing Win SDK after VS2008 breaks XAML Intellisense

Several VS 2008 and Windows SDK users have reported that Intellisense stops working for XAML projects  after installing the Windows SDK for Windows Server 2008 and .NET Framework 3.5.

 The Windows SDK Team and the Visual Studio 2008 team has been able to repro the issue and the cause has been identified.  A Visual Studio registry value is being incorrectly reset after the Windows SDK is installed, causing this failure. 

 How to determine if  you are experiencing this issue

1.       Please review the article, Windows registry information for advanced users before using regedit.

2.       Using regedit, look at the key:  

·         On X86 machines: HKEY_CLASSES_ROOT\CLSID\{73B7DC00-F498-4ABD-AB79-D07AFD52F395}\InProcServer32

·         On X64 machines: HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{73B7DC00-F498-4ABD-AB79-D07AFD52F395}\InProcServer32

3.       If (Default) is empty you are experiencing this issue

 We suggest two workarounds: repair Visual Studio 2008 or register TextMgrP.dll manually. 

Repair Visual Studio 2008:

1.       From the Start button, open the  Control Panel

2.       Click on Program and Settings (Add/Remove Programs on non-Vista machines)

3.       Click to select Visual Studio 2008 and click Change (at the top of the window)

4.       When the change dialog box launches, select Repair 

 Register TextMgrP.dll manually

On an X86 machine:

1.       Open a Windows CMD window as an Administrator (On Vista: Start, All Programs, Accessories, right-click on command prompt and  choose to Run as Administrator)

2.  Type: regsvr32 "%CommonProgramFiles%\Microsoft Shared\MSEnv\TextMgrP.dll”

 

On an X64 machine:

1.       Open a Windows CMD window as an Administrator (On Vista: Start, All Programs, Accessories, right-click on command prompt and  choose to Run as Administrator)

2.  Type: regsvr32 "%CommonProgramFiles(X86)%\Microsoft Shared\MSEnv\TextMgrP.dll”

 

 Restart Visual Studio and Intellisense should be working correctly again.

Using Visual C++ 2008 Express with the Windows SDK (short version)

 This article describes what you need to do to build Win32 applications using Visual C++ Express and the Windows SDK for Windows Server 2008 and .NET Framework 3.5.  A more detailed explanation including screenshots can be found here With the Visual Studio 2008 Express versions you can build Win32 applications right out of the box.  You no longer have to manually integrate the Windows SDK content with VC++ Express.

 

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 included with VS2008 editions are more recent than those that ship in the Vista Update SDK and the Windows Server 2003 Platform SDK.

 

If you install another SDK, such as the Windows SDK for Windows Server 2008 and .NET Framework 3.5 after you install VS, you are ready to develop with the headers, libraries and tools in the SDK for Windows Server 2008.  Read on if you installed the SDK before installing Visual Studio.  (It’s easy to switch back if you want.) 

 

Here’s how:

Step 1: Install Microsoft Visual C++ 2008 Express.

Step 2: Install the Windows SDK for Windows Server 2008 and .NET Framework 3.5.

You’re done.  After installing the Server 2008 SDK, the registry key is set to point to the new Server 2008 SDK (v6.1) content.  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.  If you want to switch back to the default (Vista v6.0A) headers and libraries that were installed with VS 2008, you should use the new SDK Configuration Tool to select the v6.0A SDK content.

Step 3: Use the SDK Configuration Tool to update the Visual C++ directories

The Windows SDK for Windows Server 2008 includes a new SDK Configuration Tool that sets the Visual Studio include, library and tools directories for you.  This tool allows you to switch quickly between the headers, libraries and tools in the installed Windows SDK(s) and those that are embedded in Visual Studio.  If you install the Windows Server 2008 SDK before you install Visual Studio, you will need to use the SDK Configuration Tool to set the directories manually.

 

 The SDK Configuration Tool has a GUI interface but it works only on the Visual Studio Retail (non-Express) SKUs.  (This is scheduled be fixed in the next release.) You will use the SDK Configuration tool at the command line with VC++ Express.

 

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 command 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.  Use ‘-version:v6.1’ for the Windows Server 2008 SDK content.  Use ‘-version:v6.0A’ for the Visual Studio 2008 content. 

 

Step 4: Validate that the directories were updated.

Open the VC++ Express command window and check the PATH to see if the v6.1 directory has been added.

How to switch directories back to the SDK content that shipped ‘in the box’ with VC++ 2008 Express

Use the SDK Configuration Tool at the command line to make v6.0A the current version.

 

You can also read the blog post Integrating Windows SDK and VS with new SDK Configuration tool for more information on the Windows SDK Configuration tool. This article describes the use of the Windows SDK Configuration tool, including how it works.

Using Visual C++ 2008 Express with the Windows SDK (detailed version)

 This article describes what you need to do to build Win32 applications using Visual C++ Express and the Windows SDK for Windows Server 2008 and .NET Framework 3.5.  A shortened, quick-start version of this article (without screenshots) can be found here. You can also read the blog post Integrating Windows SDK and VS with new SDK Configuration tool for more information on the Windows SDK Configuration tool. This article describes the use of the Windows SDK Configuration tool, including how it works.

 

You probably know that you can use Visual C++ Express to build .NET Framework applications immediately after installation.  With the Visual Studio 2008 Express versions you can also build Win32 applications right out of the box.  You no longer have to manually integrate the Windows SDK content with VC++ Express. 

The Visual Studio 2008 editions are seamlessly integrated with the Windows SDK.  VS2008 editions have 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 that ship with VS2008 editions are more recent than those that ship in the Vista Update SDK. 

 install_Express - Share on Ovi

Updating the Windows SDK Content in Visual C++2008 Express

You can build Win32 applications right out of the box with the Vista RTM headers and libraries.  If you installed the Windows SDK for Windows Server 2008 and .NET Framework 3.5 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.

 

Step 1: Install Microsoft Visual C++ 2008 Express