我在此处按照文档进行设置以进行Microsoft C#开发,并在此步骤中构建C#vSphere DLL,在开发人员命令提示符中获得以下信息:
C:\Users\user\Downloads\VMware-vSphereSDK-6.5.0-4571253\SDK\vsphere-ws\dotnet\bin>build.bat 1 file(s) copied. Fixing HttpNfcLeaseInfo type, adding missing leaseState property Generating VimService.cs Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 4.6.1055.0] Copyright (c) Microsoft Corporation. All rights reserved. Generating files... C:\Users\user\Downloads\VMware-vSphereSDK-6.5.0-4571253\SDK\vsphere-ws\dotnet\bin\VimService.cs Compiling original VimService.dll Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 4.6.1055.0] Copyright (c) Microsoft Corporation. All rights reserved. Generating XML serializers... C:\Users\user\Downloads\VMware-vSphereSDK-6.5.0-4571253\SDK\vsphere-ws\dotnet\bin\VimServiceSerializers.cs 1 file(s) copied. Optimizing VimService.cs by stripping serializer hint attributes. Compiling optimized VimService.dll FAILED
查看build.bat
它似乎在此行上失败:
echo Compiling optimized VimService.dll csc /t:library /out:Vim25Service.dll VimService.cs VimServiceSerializers.cs >nul || goto ERROR
如果我csc /t:library /out:Vim25Service.dll VimService.cs VimServiceSerializers.cs
手动运行,则会得到以下信息:
C:\Users\user\Downloads\VMware-vSphereSDK-6.5.0-4571253\SDK\vsphere-ws\dotnet\bin>csc /t:library /out:Vim25Service.dll VimService.cs VimServiceSerializers.cs Microsoft (R) Visual C# Compiler version 1.3.1.60616 Copyright (C) Microsoft Corporation. All rights reserved. VimServiceSerializers.cs(32548,98): error CS8078: An expression is too long or complex to compile
我也尝试过VS2017:
C:\Users\user\Downloads\VMware-vSphereSDK-6.5.0-4571253\SDK\vsphere-ws\dotnet\bin>csc /t:library /out:Vim25Service.dll VimService.cs VimServiceSerializers.cs Microsoft (R) Visual C# Compiler version 2.0.0.61213 Copyright (C) Microsoft Corporation. All rights reserved. VimServiceSerializers.cs(31372,109): error CS8078: An expression is too long or complex to compile
注意,VimServiceSerializers.cs(#####,##)
行和列上的行为每次都不同。
Google搜寻错误CS8078,发现这是编译器堆栈空间不足的问题。/sf/ask/17360801/
如何成功编译VmWare的代码?