6.0

Table Of Contents
VMware, Inc. 23
Chapter 3 Setting Up for Microsoft C# Development
To build the C# sample programs
1 Launch Visual Studio and load the solution file, Samples2008.sln.
The solution file is found in the %SDK_HOME%\vsphere-ws\dotnet\cs\samples directory.
If you are using a version of Visual Studio later than 2008, the Visual Studio Conversion Wizard prompts
you to convert the 2008 solution file to the newer version.
If you also have Visual Studio 2008, select Yes when the wizard prompts you to save a backup of the
original solution file.
If you do not have Visual Studio 2008, you do not need to save a backup of the original solution file.
2 If you are using a version of Visual Studio later than 2008, convert each project to use .NET Framework 4.
a To convert a project to use .NET Framework 4, right-click its name in the Solution Explorer and select
Properties.
b In the Properties panel, change the Target Framework from .NET Framework 3.5 to .NET
Framework 4.
3 From the Visual Studio menu, select Build > Build Solution.
All the sample programs build. The Output pane at the bottom of the Visual Studio window shows build
errors, if any.
4 Correct any errors in the build, and repeat the build.
Running the Microsoft .NET C# Version of SimpleClient
The SimpleClient sample application connects to a vSphere host, lists the names and reference IDs of the
managed objects in the inventory, and disconnects from the host.
Run the SimpleClient C# application
You can use the SimpleClient sample application to test your setup and connectivity.
Prerequisites To Run the SimpleClient C# Application
Verify that the following conditions exist:
Your development environment is set up. See “Setting Up for C# Development” on page 17.
The SSO DLL is built. See “Building the C# SSO DLL” on page 19.
The vSphere DLLs are built. See “Building the C# vSphere DLLs” on page 20.
To run the SimpleClient application
1 Open a Visual Studio Tools command shell.
2 Navigate to the subdirectory where the compiled object code is located.
From the top-level directory of the SDK download, the directory is as follows:
%WS_SDK_HOME%\dotnet\cs\samples\SimpleClient\bin\Debug
3 Run the application, passing at least the service URL, an authenticating user name, and a password on the
command line.
For a development environment, you do not need to use SSO or certificate authentication. You can
authenticate directly with the server by specifying --disablesso and --ignorecert on the command
line. For example:
simpleclient --url https://esx.exampledomain.com/sdk --username root --password secret
--disablesso --ignorecert
The application connects to the server and displays a list of inventory objects managed by the server.