Hello.
I am using new vSphere sdk.First step for me is to retrive the dll out of wsdl file.
with vsphere SDK I got 2 Folders
vim
vim25
when I am excuting "genvimstubs.cmd" with both the folders I am getting vimservice2005.dll and Vimservice2005.xmlSerailizers.dll
I need to compile the AppUtil project which needs the reference of Vim25Service2005 and Vim25Service2005.xmlSeralizers
How can I generate Vim25Service2005.dll and Vim25Service2005.xmlSeralizers.dll?
Thanks,
-AsHwIN
Try to modify the bacth file genvimstubs.cmd and put into it the correct parameter values.
I hope is helpful.
Ermanno De Giuli
Vmware vcp
I have modified the batch command file in this mode and it works.
@rem 22 Maggio 2009 - 19:00
@rem Ermix per creare le dll per vi 2.5
@rem dev@informan.com
@setlocal
@echo off
@rem Generate WebService Stubs and precompiled stub serializers
@if not defined VSINSTALLDIR goto err_no_VCENVSETUP
if not exist %VSINSTALLDIR%\SDK\v2.0\bin\wsdl.exe goto err_no_VSTOOLS
if not exist %WINDIR%\Microsoft.NET\Framework\v2.0.50727\csc.exe goto err_no_VSTOOLS
@rem This script takes 6 parameters
@rem 1. directory of wsdl files. This is a mandatory parameter.
@rem 2. namespace for stubs
@rem This defaults to VimApi
@rem 3. stub output directory
@rem This defaults to .
@rem 4. output filename
@rem This defaults to VimObjects.cs
@rem 5. dll directory
@rem This defaults to .
@rem 6. Name of the DLLs to generate.
@rem This defaults to VimService2005*
@rem this script assumes that the files are named vim.wsdl and vimservice.wsdl
@if not exist %1\vim.wsdl goto err_no_WSDLFILE
@if not exist %1\vimService.wsdl goto err_no_WSDLFILE
@set _WSDLDIR=%1
@set _NAMESPACE=Vim25Api
) else (
@set _NAMESPACE=%2
)
@set _STUBDIR=.
) else (
@set _STUBDIR=%3
)
@set _STUBFILENAME=Vim25Objects.cs
) else (
@for /f "tokens=1" %%G in ('echo %~n4') do (
@set _STUBFILENAME=%%G
@call :set_filename %%G
)
@goto done_setfilename
:set_filename
@set _STUBFILENAME=%1.cs
@goto :eof
:done_setfilename
@set dummy=
)
@set _DLLDIR=.
) else (
@set _DLLDIR=%5
)
@set _DLLNAME=Vim25Service2005
) else (
@set _DLLNAME=%6
)
@set _LASTPASS=no
@if "%_STUBDIR%"=="." goto create_dll_dir
echo Checking and Creating %_STUBDIR%
@if not exist %_STUBDIR% (
@rd /s/q %_STUBDIR%
@if exist %_STUBDIR% (
@rd /s/q %_STUBDIR%
)
)
@md %_STUBDIR%
:create_dll_dir
@if "%_DLLDIR%"=="." goto gen_vim_stubs
echo Checking and Creating %_DLLDIR%
@if not exist %_DLLDIR% (
@rd /s/q %_DLLDIR%
@if exist %_DLLDIR% (
@rd /s/q %_DLLDIR%
)
)
@md %_DLLDIR%
:gen_vim_stubs
@rem generate the Vim C# stub file
wsdl.exe /l:CS /n:%_NAMESPACE% /out:%_STUBDIR%\%_STUBFILENAME% %_WSDLDIR%\vim.wsdl %_WSDLDIR%\vimService.wsdl
@rem compile the stub dll
:compile_DLL
csc.exe /t:library /out:%_DLLDIR%\%_DLLNAME%.dll %_STUBDIR%\%_STUBFILENAME%
@if "%_LASTPASS%"=="yes" goto end_ok
@rem use sgen tool to pre-generate and compile Xml Serializers
sgen.exe /p /out:%_DLLDIR% %_DLLDIR%\%_DLLNAME%.dll
@rem comment out all [System.Xml.Serialization.XmlIncludeAttribute lines
@echo Optimizing generated stubs...
OptimizeWsStubs.exe %_STUBDIR%\%_STUBFILENAME% %_DLLNAME%
@set _LASTPASS=yes
goto compile_DLL
:err_no_STUBDIR
@echo Error: Directory to build stubs in %_STUBDIR% does not exist
goto end_err
:err_no_DLLDIR
@echo Error: Directory to compile DLLs in %_DLLDIR% does not exist
goto end_err
:err_no_WSDLFILE
@echo Error: Directory for WSDL files vim.wsdl and vimService.wsdl not specified
@echo Please specify WSDL files to generate stubs for
@echo Run As: genvimstubs.cmd <WSDL Directory> http://<Stub filename with .cs> http://<Stub Dll name(without .dll extension)>
@echo E.g.
@echo genvimstubs.cmd .\
@echo Or to customize namespace stubfilename and dll names etc...
@echo genvimstubs.cmd .\ VimApi .\stubdir MyVimStubs.cs .\dlldir MyVimStubs
@echo
:err_no_VCENVSETUP
@echo Error: No Visual Studio 2005 environment settings found
@echo Please run this script inside a Visual Studio 2005 Command Prompt
@echo
:end_err
@echo Stub generation Failed!
@echo
goto end
:end_ok
@echo Stub generation Done.
@echo
:end
@endlocal
To build vSphere SDK C# solution you need to run batch file Build2005.cmd after creating the appropiate Environment variables.