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

时间:2015-01-08 11:59:47

标签: powershell azure msbuild cspack

我有一个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和工具的痕迹,并再次安装必要的部分反驳没有任何帮助。

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

1 个答案:

答案 0 :(得分:0)

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

修改 Azure SDK 2.7中已修复此问题