使用 MSBuild 打包云服务项目时出现 CSPack RemotingException

CSPack RemotingException while packaging Cloud service project with MSBuild

我有一个 powershell 脚本,用于打包我们的构建并将它们部署到 Azure 云服务。这个脚本在 SDK 2.3 上运行没有任何问题,但是当我们升级到 SDK 2.5 时,我们在构建项目时开始收到以下错误:

CorePublish:
  CorePublish: PackageWebRole = True
  Publishing starting...
  RolePlugins       is 
  Importedmodules is 
  Publishing to 'bin\Release\app.publish\'
  Creating directory "bin\Release\app.publish\".
  TargetServiceDefinition is bin\Release\ServiceDefinition.csdef
  TargetServiceConfiguration is bin\Release\ServiceConfiguration.cscfg
  Roles is E:\Preview\temp\Azure\obj\Release\App\
error MSB4018: The "CSPack" task failed unexpectedly. 
System.Runtime.Remoting.RemotingException: Object '/54628d54_42c6_4d39_bc4c_958b6bfaeb90/6y8efa6v6y8omskqeetyix8g_4.rem' has been disconnected or does not exist at the server. 
   at System.IO.FileStream.get_CanRead() 
   at MS.Internal.IO.Zip.ZipIOLocalFileBlock.CheckFileAccessParameter(Stream stream, FileAccess access) 
   at MS.Internal.IO.Zip.ZipIOLocalFileBlock.GetStream(FileMode mode, FileAccess access) 
   at System.IO.Packaging.ZipPackagePart.GetStreamCore(FileMode mode, FileAccess access) 
   at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access) 
   at Microsoft.ServiceHosting.Tools.Packaging.Utils.CopyFullStreamToPart(Stream source, PackagePart part, PackageManifest manifest) 
   at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreateRolePackages(ModelProcessor modelProcessor, PackageManifest applicationManifest, Package applicationPackage) 
   at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreatePackage(Stream outputStream, Action`1 postProcess, PackageRestrictions restrictions) 
   at Microsoft.ServiceHosting.Tools.Packaging.ServiceApplicationPackage.CreateServiceApplicationPackage(String serviceModelFileName, String serviceDescriptionFile, Stream output, IPackageSecurity encrypt, Dictionary`2 namedStreamCollection, String userInfo, EventHandler`1 rolePackagePartAddedHandler) 
   at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary) 
   at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary) 
   at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.TryCreatePackage(ServiceDefinitionModel sm) 
   at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.Execute() 
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() 

它在 Windows Server 2008 R2 上运行,使用来自 VS2013 的 MSBuild 并且 MSBuild 像这个参数(来自 powershell)一样运行:

& $msBuildPath "$tempPath\Azure\Azure.ccproj" /p:TargetProfile=Cloud /p:Configuration=Release /target:publish /flp:"Verbosity=quiet;logfile=E:\AzurePreview\msbuild.log"
I could not find anything connected to this issue.

我什至尝试删除所有可能连接到 powershell、VS 或 Azure 的 VS、SDK 和工具的痕迹,并再次安装必要的部分,但没有任何帮助。

你能帮我解决这个问题吗?

在与 Microsoft 支持人员讨论此问题后,我能够使用 CSPack 命令行工具打包项目,因此我将其用作解决方法。

编辑: 此问题似乎已在 Azure SDK 2.7

中修复