VMware vSphere SDK with Visual Studio 2012

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.

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

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.

This entry was posted in vSphere API and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. Posted October 30, 2012 at 2:35 am | Permalink

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

  2. Posted October 30, 2012 at 3:07 am | Permalink

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

  3. sebastien crocquesel
    Posted February 11, 2013 at 1:45 pm | Permalink

    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. Posted February 11, 2013 at 2:02 pm | Permalink

    Thanks for sharing your trick. Whatever works is good.

  5. sampath
    Posted September 5, 2013 at 1:13 am | Permalink

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

  6. Posted September 6, 2013 at 10:10 pm | Permalink

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


  7. Posted January 13, 2015 at 6:16 pm | Permalink

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

One Trackback

  • By Tofa IT » VMware vSphere SDK with Visual Studio 2012 on October 30, 2012 at 12:00 pm

    […] project files for the VS 2012 by yourself assuming you are already familiar with the Visual […]VMware vSphere SDK with Visual Studio 2012 originally appeared on DoubleCloud by Steve Jin, author of VMware VI and vSphere SDK (Prentice […]

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__ doublecloud.org.

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.