Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is VMware vSphere SDK C# samples required references for VimApi namespaced classes?

Tags:

c#

sdk

vmware

I cannot compile the C# samples from the VMware vSphere SDK 5.0 using Visual Studio 2010. The error is missing references for namespaces AppUtil and VimApi.

The references in the VS2010 solution file point to these files.

..\AppUtil\bin\Debug\AppUtil.dll
..\..\Vim25Service2010.dll
..\..\Vim25Service2010.XmlSerializers.dll
..\..\VimService2010.dll
..\..\VimService2010.XmlSerializers.dll
..\VMware.Security.CredentialStore\bin\Debug\VMware.Security.CredentialStore.dll

Where are these files in the SDK, or how do I get them if not in the SDK?

Two of the references are from other projects in the solution; including the AppUtil namespace. I can update each project to reference the project instead of the debug output.

Is there a build step I am missing to generate the other dlls? Is VimApi part of a different download? The release notes don't mention additional downloads to get the projects to compile.

like image 329
Jason Avatar asked Sep 21 '11 18:09

Jason


People also ask

What is VMware SDK?

VMware SDKs provide easy creation of applications by supplying developers with information, downloads, documentation, and resources. After implementation developers will be able to certify and validate products through program specific certification kits. Some SDKs (e.g. NSX, vSAN, etc.)

What is VMware SDK URL?

By default, the following URL is used to connect to ESX or ESXi, and vCenter. For ESX or ESXi: https://{manager-address}/sdk/vimService.wsdl. For vCenter: https://{manager-address}/sdk/vimService.wsdl.

What is VMware SDK support?

VMware SDK and API Support is available in two service level agreements: Standard support provides a response within two business days, and Premium support provides a response within one business day. SDK Support engineers won't write or test your code, but they may suggest sample code for a possible solution.


2 Answers

I hate to answer my own question, but I came up with a solution. Based on the KB article pointed to from the readme I was able to create instructions for VS2010. Run the following commands from the directory that has the solution file inside a Visual Studio command prompt.

rem Script to generate required references for VMware vSphere SDK 5.0

cd ..
if not exist VimService2010.dll (
    wsdl /n:VimApi /o:VimService.cs ..\..\wsdl\vim\vim.wsdl ..\..\wsdl\vim\vimService.wsdl
    csc /t:library /out:VimService2010.dll VimService.cs
    sgen /p VimService2010.dll
)

if not exist Vim25Service2010.dll (
    wsdl /n:Vim25Api /o:Vim25Service.cs ..\..\wsdl\vim25\vim.wsdl ..\..\wsdl\vim25\vimService.wsdl
    csc /t:library /out:Vim25Service2010.dll Vim25Service.cs
    sgen /p Vim25Service2010.dll
)

This script creates the needed dll files from the wsdl files in the SDK.

like image 137
Jason Avatar answered Oct 20 '22 11:10

Jason


Chapter 3 of the developers setup guide explains how to build the VimService dlls. Jason's script above works, but leaves out one critically important (and irritating) step.

After generating the XMLSerializer dll, you need to EDIT the VimService.cs file to force the reference to the XMLSerializer assembly and remove the inline XMLIncludeAttribute calls. After the edit (which is explained in the setup guide) you need to recompile VimService.

It works without doing the edit, but it can cause a HUGE delay when instantiating VimService. I found it to be a 3 minute wait, which was unacceptable. If you're encountering the delay, recompile VimService according to the instructions and update your reference to the new assembly (and make sure your build isn't hanging on to the old version).

like image 43
Mike Avatar answered Oct 20 '22 13:10

Mike