Category Archives: Microsoft .NET

Extracting VMware Web Service Proxies for .NET

The current VMware 5.1 SDK no longer redistributes pre-built .NET proxies, just the source WSDL. If you follow the documentation you are directed to complete a complicated procedure to generate and your own signed proxies.

Fortunately, there is an easier way to extract official signed assemblies from a VMware PowerCLI (PowerShell extensions) installation. This is much better than the previous method as you are using original DLLs provided (and supported by) VMware.

  1. Download and install the current VMware PowerCLI.
  2. Install the PowerCLI which includes the VMware VIX infrastructure components.
  3. Although the PowerCLI documentation suggests you reference VMware.Vim.dll in the program files infrastructure path, we won’t do this because some additional files are missing and we want a full stand-alone copy. The VMware VIX setup installs everything primarily in the GAC. So we will run one command to extract  the files we need from the GAC and copy them into the source so they can be referenced locally and checked-in. Change the “.” at the end of the following command to your own target path, else it copies into the current directory:
    for /f %i in ('dir %WinDir%\assembly\GAC_MSIL\*Vim*.dll /s /b') do copy %i .
  4. This will find several files of which the following are necessary to call VMware web services:
  5. Add a reference to VMware.Vim.dll then use the proxy classes there to call the web services, according to the VMware Web Services SDK documentation. Note that the main VIM assembly will load the relevant VimService## proxy according to the version it detects when connecting to the server (factory pattern), so you need them all including the XML serialization assemblies (it’s hard-coded, they are not optional)!

As a best practice I like to check-in all stand-alone dependencies into a “Dependencies” folder of the solution/checked-in source tree. Make sure you also redistribute these files with your application. I prefer this “local copy” method because this enables your code to compile on any developer PC or build server and be deployed as a stand-alone package.