Workaround: Install WinSDK for SVR2008 after VS2008 breaks VS command line build environment (vcvars32.bat)


  • 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


    2008年4月18日 21:53


  •   All these changes are already there , but still i am not able to generate a X.509 certificate.
    2008年12月8日 12:00
  • I experienced this problem and when I was gonna go and try to fix it there was no bin folder in the VC folder :/
    2009年8月22日 20:54
  • Another problem is this:


    If you installed VS 2008 on a drive other than C:, then you will have something like this:


    E:\Microsoft Visual Studio 9.0\{blah, blah, blah}

    But, you WILL NOT have

    E:\Microsoft Visual Studio 9.0\vc\vcpackages


    That folder, which contains vcbuild.exe, will actually be here:

    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages


    I fixed it by just copying the whole “vc” folder over to E:

    2009年9月21日 16:30
  • I had the same problem, but non of the fix works. I had to uninstall the toolkit to get VS2008 build command promot back to normal.
    2010年3月24日 10:54
  • thank you
    Need Help
    2010年4月23日 18:42
  • I have sucessfully installed vs2010 x86 premium on my wn 7 x64

    The other versions (beta,ultimate from dreamspark ) did not work on win 7 x64.


    2010年4月26日 6:39
  • Hi

    It did not worked as the RTM and Beta does not support completely for x64 untill its released. These are the evaluations which help MS to under stand the user problem with the help of Windows error reporting service. There is some work around to make it work on x64 architecture. Please have a look on the below post may be it can help to understand.

    Raman Katwal
    2010年5月31日 3:44
  • I had the same problem, but non of the fix works. I had to uninstall the toolkit to get VS2008 build command promot back to normal.

    I also have this problem. Even if I have uninstalled the toolkit, I still can't get my VS2008 back to normal. I have to reinstall it. This sucks!.
    2010年6月12日 11:27
  • Works for me.
    2011年3月3日 20:49
  • Hi, i am trying to integrate intel ipp into visual studio 2008 but unfortunately it doesn't seem to have succeeded it, i have questioned at intel ipp forum but i haven't solved my problem jet.


    i tried to do the steps above as you suggested but when i open the vcvars32.bat file  manually, there aren't these lines as you said above, there is only one line: 


    what can i do?


    thank you

    2011年12月15日 11:24