Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Monday, November 29, 2010

How to develop your own VMWare application in C#

First, download and install "Visual Studio Express 2008" (http://www.microsoft.com/express/Downloads/)
Then download and install "VMware vSphere Web Services SDK" (http://www.vmware.com/download/sdk/)

In file Build2008.cmd (from your "VMware vSphere Web Services SDK directory\samples\DotNet" directory) if you installed your VS2008 Express in an other directory than default directory modify line
set VSINSTALLDIR="C:\Program Files\Microsoft Visual Studio 9.0"

Run a command line prompt.

Verify in command line prompt you can run
- WSDL.exe (by default at C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin)
- csc.Exe (by default at C:\WINDOWS\Microsoft.NET\Framework\v3.5)
- VCSExpress.exe (by default at C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE)

Else add path of these programs with something like this in command line before running Build2008.cmd:
Set path=%path%;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE

In command line prompt do not forget to run this line too:
set WSDLFILE=your VMware vSphere Web Services SDK directory\wsdl

Then run Build2008.cmd
You should have all your .dll libraries created.

Run in your VMware vSphere Web Services SDK directory\samples\DotNet\cs\SimpleClient\bin\Debug this line to verify all is ok:
SimpleClient.exe https://yourvc/sdk yourvcuser yourvcpassword

Now, if you need to create your own application, just add line
using Vim25Api;
and in your project "add reference" tab browse
"Vim25Service2008.dll" and "Vim25Service2008.XmlSerializers.dll"

Use examples in your vSphere Web Services SDK\directory\samples\DotNet\cs for helping you to create your 1st C# vmware application