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 refer开发者_开发知识库ences 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.
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.
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).
Example instructions on how to modify the VimService.cs file can be found here.
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=87402
It's a real shame VMware didn't pre-build the assemblies like before. There are 100s of lines to manually edit if you follow their instructions to do it properly and avoid hangs. So I wrote some scripts to do this properly.
You can find them here...
I also experienced that the dlls are missing. I've chosen to build on the VMware.Vim.dll too but am sort of boated out now too. I was using the one that was found in the PowerCLI, but suddenly it's gone.
I've already requested an answer from the community but nobody answered that... have a look: http://communities.vmware.com/message/1815356#1815356
I've also written a small "how to start" but became no feedback at all. It's outdated too since the dll is gone now. But maybe it helps when you've found the right dlls: http://communities.vmware.com/message/1806388#1806388
Hope this helps, at least by showing what not to do.
Greetings, Kjellski
精彩评论