Caution: Articles written for technical not grammatical accuracy, If poor grammar offends you proceed with caution ;-)
I went to install the VMware SDK for vSphere 4.0 on to my desktop running Windows 7 64-bit, Visual Studio 2008, and .Net 3.5 SP1 and discovered the SDK setup is not friendly with these versions. According to VMware you need Visual Studio 2005 and .Net 2.0 if you want to run the SDK.
So like most of you reading this I turned to my trusted adviser…google to find the answer I was looking for. Much to my disappointment after 5 minutes of searching around I didn’t find any instant gratification for my problem so I decided to just go ahead and figure it out on my own.
It turned out to be a relatively easy task once I discovered what was causing my issues. There are two windows cmd scripts that need to be edited to point to the proper locations of your installations. I have included the modified cmd files in our downloads section for those of you that would like them. These files are built to support my specific configuration but they are very easily edited to support your configuration.
In the beginning of the Build2005.cmd file there are some if statements that check to ensure you have the install directory for Visual Studio 2005 defined properly. Like below:
if not defined VSINSTALLDIR ( @set VSINSTALLDIR="C:Program FilesMicrosoft Visual Studio 8" ) else ( @rem need the quotes to hide the spaces! @set VSINSTALLDIR="%VSINSTALLDIR%" )
In favor of just wanting to get the SDK installed and working I decided to cut out the fat and just include what was needed to make this work so I removed that bit of code and replaced it with code that set VSINSTALLDIR to the full path of my Visual Studio 2008 installation:
@set VSINSTALLDIR="C:Program Files (x86)Microsoft Visual Studio 9.0"
Next I took another bit of code designed to check and see if you have Visual Studio 2005 Express or Visual 2005 installed seen below and modified that to my needs:
if exist %VSINSTALLDIR%Common7IDEVCSExpress.exe ( @echo Visual Studio C# 2005 Express is installed @set DEVENV=VCSExpress.exe ) else ( if exist %VSINSTALLDIR%Common7IDEdevenv.exe ( @echo Visual Studio 2005 is installed @set DEVENV=devenv.exe ) else ( goto err_NO_DEVENV ) )
I am running the full version of Visual Studio 2008 so I modified the DEVENV statement for my needs. If you are running Visual Studio 2008 Express you will want to modify to support your version.
@set DEVENV="C:Program Files (x86)Microsoft Visual Studio 9.0Common7IDEdevenv.exe"
Lastly for the Build2005.cmd file I modified some statements referencing the .Net 2.0 Framework seen below:
@if not defined FrameworkDir ( @echo Setting Path @rem set PATH to use VCSExpress.exe or VisualStudio's Devenv.exe @rem Assumes .NET is installed in the default location. @set PATH=%PATH%;%VSINSTALLDIR%Common7IDE @set PATH=%PATH%;%VSINSTALLDIR%SDKv2.0bin @rem Assumes that .NET 2.0 is installed in the default location @set PATH=%PATH%;%WINDIR%Microsoft.NETFrameworkv2.0.50727 @rem for Visual Studio 2005, and Visual C# 2005 Express, @rem INCLUDE, LIB and LIBPATH are not required @rem since we're only building C# samples @set INCLUDE= @set LIB= @set LIBPATH= )
To the following:
@echo Setting Path 1 @rem set PATH to use VCSExpress.exe or VisualStudio's Devenv.exe @rem Assumes .NET is installed in the default location. @set PATH=%PATH%;"C:Program Files (x86)Microsoft Visual Studio 9.0Common7IDE" @set PATH=%PATH%;"C:Program Files (x86)Microsoft Visual Studio 9.0SDKv3.5bin" @rem Assumes that .NET 2.0 is installed in the default location @set PATH=%PATH%;"C:Program Files (x86)Microsoft Visual Studio 9.0Microsoft.NETFrameworkv2.0.50727" @rem for Visual Studio 2005, and Visual C# 2005 Express, @rem INCLUDE, LIB and LIBPATH are not required @rem since we're only building C# samples @set INCLUDE= @set LIB= @set LIBPATH=
You’ll notice I used full paths rather than using environment variables to set the paths for me. I did this because I wanted to be able to ensure my full paths were correct. With Windows 7 64-bit it was important to utilize quotes because of the brackets around the x86 in the program files directory name.
Once I complete these changes I then moved on to the genvimstubs.cmd file. this file has only one area that I needed to modify. At the top of the file you will notice another if statement designed to check for tools that are necessary to setup the vimstubs as follows:
@if not defined VSINSTALLDIR goto err_no_VCENVSETUP if not exist %VSINSTALLDIR%SDKv2.0binwsdl.exe goto err_no_VSTOOLS if not exist %WINDIR%Microsoft.NETFrameworkv2.0.50727csc.exe goto err_no_VSTOOLS
I took this section and commented out two of the statements as follows:
@if not defined VSINSTALLDIR goto err_no_VCENVSETUP @rem if not exist "C:Program Files (x86)Microsoft Visual Studio 9.0SDKv3.5binwsdl.exe" goto err_no_VSTOOLS @rem if not exist "C:WindowsMicrosoft.NETFrameworkv3.5csc.exe" goto err_no_VSTOOLS
Once I completed that modification all worked and worked very well. I received the expected output from the SDK setup and was able to connect to my VC server utilizing the VMware sample code for “SimpleClient” as directed in the SDK setup guide.
A few important things point out is based on my changes the Visual Studio 2008 installation folder is:
C:Program Files (x86)Microsoft Visual Studio 9.0 I extracted the VMware SDk to : C:Program Files (x86)VMwareSDK
The Microsoft .Net Framework 2.0.x location is also under the Program Files (x86) directory. If you either utilize the same locations or compensate the cmd files to support your file location everything should go just fine.