VMware {code} Community
ChaitanyaS
Contributor
Contributor

How to build the C# samples provided with the vSphere SDK?

Hi,

This is for the first time I'm using the VMware web services. I downloaded the "VMware vSphere web services SDK (4.0) and tried to open the C# samples' solution provided with it.

When i try to build the solution in Visual Studio 2005 IDE, it does not succeed. I found that a few references are missing. Some of them are :

- AppUtil

- Vim25Service2005

- Vim25Service2005.XmlSerializer

- VimService2005

- VimService2005.XmlSerializer

- VMware.Security.CredentialStore

What do i need to do to get rid of this build errors? From where can i get references for them?

0 Kudos
7 Replies
lamw
Community Manager
Community Manager

Have you taken a look at this document: , it's everything you need to know to get started. Specifically this document should help Set up your environment by reading the Developer’s Setup Guide

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

ChaitanyaS
Contributor
Contributor

Hi William,

Thank you very much. I had not gone through the I'mreading the document now.

I think, first i need to get access to the ESX server where the web services are hosted, right?

And once i add the web references of those web services (asmx) in the C# samples provided by SDK, i can manage ALL the ESX servers in my network. Please correct me if i'm wrong.

I know all these are very basic questions but i'm new to this VMware developement too.

0 Kudos
storm27
Enthusiast
Enthusiast

Hi Chaitanya,

The build errors you are seeing are basically due to incorrect path or path not set for the vSphere SDK and other jars available.

Please go through the setup guide for the same ( I suppose you already did that)

Now, for running your first sample, refer to Connect sample. This sample gets you connected to the ESX server or vCenter.

The first thing you need to do in order to perform any operation on ESX or vCenter is to get connected and retreive the service content data object.

Refer to the available samples that are shipped with the SDK package.

Hope this information helps.

-Angela

jeffpurcell
Enthusiast
Enthusiast

You first need to build the SDK using the appropriate Build batch file. Likely Build2005.cmd for Visual Studio 2005.

As Angela suggests, take a look at the readme documentaiton to build the kit, you might also benefit from the following thread.

http://communities.vmware.com/message/1291951#1291951

0 Kudos
ChaitanyaS
Contributor
Contributor

Hi,

As suggsted in a thread you have given, i simplfied the path. Environment variables too are set up properly. But somehow when i run the "Build2005", i get the following:

E:\vSphereSDK\SDK\samples\DotNet>Build2005

Visual Studio 2005 is installed

Error: Directory for WSDL files vim.wsdl and vimService.wsdl not specified

Please specify WSDL files to generate stubs for

The system cannot find the file specified.

E.g.

genvimstubs.cmd .\

Or to customize namespace stubfilename and dll names etc...

genvimstubs.cmd .\ VimApi .\stubdir MyVimStubs.cs .\dlldir MyVimStubs

ECHO is off.

Error: No Visual Studio 2005 environment settings found

Please run this script inside a Visual Studio 2005 Command Prompt

ECHO is off.

Stub generation Failed!

ECHO is off.

Error: Directory for WSDL files vim.wsdl and vimService.wsdl not specified

Please specify WSDL files to generate stubs for

The system cannot find the file specified.

E.g.

genvimstubs.cmd .\

Or to customize namespace stubfilename and dll names etc...

genvimstubs.cmd .\ VimApi .\stubdir MyVimStubs.cs .\dlldir MyVimStubs

ECHO is off.

Error: No Visual Studio 2005 environment settings found

Please run this script inside a Visual Studio 2005 Command Prompt

ECHO is off.

Stub generation Failed!

ECHO is off.

Building Samples in Debug mode

Done Building optimized Stubs and all Samples

When i open the solution file in Visual Studio and try to build it, i get lots of error where the references are not resolved. I have hosted WSDL files on my local machine and added web refernce to them too.

Can you please guide me further?

0 Kudos
ChaitanyaS
Contributor
Contributor

I created proxy classes and the DLL using web services in the "SDK\wsdl\vim25" folder. DLLs are created successfully which i have added as a reference in one of the sample projects. However, there is one namespace called "VimApi" which is not getting resolved.

What could be the reason?

0 Kudos
ChaitanyaS
Contributor
Contributor

I could solve the problem and SDK samples are built sucessfully.

Thank you all for helping me.

0 Kudos