Home > vSphere API > VMware vSphere SDK with Visual Studio 2012

VMware vSphere SDK with Visual Studio 2012

October 30th, 2012 Leave a comment Go to comments

While trying latest Microsoft Visual Studio 2012 Express, I also played with the C# samples of the VMware vSphere SDK. Unfortunately, there isn’t direct support for VS 2012 but for VS 2010, 2008, and 2005. However, you can easily create project files for the VS 2012 by yourself assuming you are already familiar with the Visual Studio environment.

To get started, you still want to read the VMware document Developer’s Setup Guide first. The chapter 3 there is “Setting Up for Microsoft C# Development” and most contents are still applicable for the VS 2012.

Time to learn how to "Google" and manage your VMware and clouds in a fast and secure


I didn’t setup environment variables as suggested in the developer guide. Instead, I used the Developer Command Prompt for VS2012 which has environment variables ready. To start it, just click on the Windows Start button then All Programs, and select it from the list as shown below. As you can see the icon, the Developer Command Prompt for VS2012 is essentially a DOS prompt with which you type in commands.

Here are several commands I used to create the dlls using the Developer Command Prompt for VS2012.

wsdl.exe /n:VimApi vim.wsdl vimService.wsdl
csc /t:library /out:Vim51Service2012.dll VimService.cs
sgen /p Vim51Service2012.dll
csc /t:library /out:Vim51Service2012.dll VimService.cs

It’s important to add the following time to the VimService.cs file after the sgen command, as documented in the guide: (yours file name could be different)

[System.Xml.Serialization.XmlSerializerAssemblyAttribute(AssemblyName =

There are quite a few samples in the vSphere SDK package in the vsphere-ws\dotnet\cs\samples subdirectory under SDK home. There are 3 pre-defined solution files there already, each of which maps to a prior version of Visual Studio. But none of these solutions work out of box with Visual Studio 2012 simply because of the referenced DLLs are different.

To leverage these existing solutions, you can copy/paste and rename it to Samples2012.sln. Once you open it, you can fix the reference in each project. There are too many projects for me to fix, therefore I just create a new solution by myself.

To run the SimpleClient project, I copied and pasted then renamed a new project file called SimpleClient2012.csproj. After adding it into solution, I simply fixed the references to the latest dlls created earlier.

The SimpleClient will need to use VMware.Security.CredentialStore and AppUtil projects whose references need to be changed to new DLLs as with SimpleClient project.

Once these are done, you can rebuild the solution and the code should be ready to run. I assume you know these flows in Visual Studio as you’ve read this far.

Like its Java support, VMware’s support for C# in its vSphere SDK is far from mature. I can still see discussion like this one in the API forum. Even more problematic are the samples that are written in the same way as the Java samples, which bothered me so much that I created the de facto vijava API. We need something similar in C#/.Net too.

  1. October 30th, 2012 at 02:35 | #1

    VMware vSphere SDK with Visual Studio 2012 http://t.co/PrjoDMaS via @sjin2008

  2. October 30th, 2012 at 03:07 | #2

    VMware vSphere SDK with Visual Studio 2012 – http://t.co/IQkNqGB6

  3. sebastien crocquesel
    February 11th, 2013 at 13:45 | #3

    It may not be a supported way nor a best practice but I usually reference directly VMware.vim assembly from PowerCLI. Which is far easier and give an abstraction on top of webservice.

  4. February 11th, 2013 at 14:02 | #4

    Thanks for sharing your trick. Whatever works is good.

  5. sampath
    September 5th, 2013 at 01:13 | #5

    what about VMware vSphere SDK with Visual Studio 2010 ?
    please provide solution for how to craete in VS2010

  6. September 6th, 2013 at 22:10 | #6

    I think VMware’s programming guide has coverage on VS2010. You may want to check it out.


  7. January 13th, 2015 at 18:16 | #7

    Wow! After all I got a website from where I be able to genuinely get valuable facts concerning my study and knowledge.

  1. October 30th, 2012 at 12:00 | #1