Part URI is not valid per rules defined in the Open Packaging Conventions specification

Stack trace:

Getting this error after upgrading to Octopus 3.1. On the server I see octopus is trying to create a new package Cloud_new and fails immediately. Any hints on this?

Extracting package to: C:\Octopus\Work\20150917085840-13
14:28:42Verbose
Extracted 2 files
14:28:42Verbose
Ensuring cloud-service-package is V20120315 format.
14:28:42Verbose
Package is Legacy format. Converting to V20120315 format.
14:28:48Error
System.ArgumentException: Part URI is not valid per rules defined in the Open Packaging Conventions specification.
14:28:48Error
at System.IO.Packaging.Package.GetPartHelper(Uri partUri)
14:28:48Error
at Microsoft.ServiceHosting.Tools.Packaging.ServicePackageBase.GetPart(Uri partUri)
14:28:48Error
at Microsoft.WindowsAzure.Packaging.PackageConverter.AddSoftwarePackageToLayout(PackageBuilder builder, String layoutPath, ServiceSoftwarePackage softwarePacakge)
14:28:48Error
at Microsoft.WindowsAzure.Packaging.PackageConverter.ConvertFromLegacy(Stream srcPackage, PackageStore dstPackage, X509Certificate2 decrypt, PackageRestrictions restrictions)
14:28:48Error
at Calamari.Azure.Deployment.Conventions.EnsureCloudServicePackageIsCtpFormatConvention.ConvertPackage(String packagePath) in Y:\work\b1fd300731d5f2fc\source\Calamari.Azure\Deployment\Conventions\EnsureCloudServicePackageIsCtpFormatConvention.cs:line 48
14:28:48Error
at Calamari.Azure.Deployment.Conventions.EnsureCloudServicePackageIsCtpFormatConvention.Install(RunningDeployment deployment) in Y:\work\b1fd300731d5f2fc\source\Calamari.Azure\Deployment\Conventions\EnsureCloudServicePackageIsCtpFormatConvention.cs:line 38
14:28:48Error
at Calamari.Deployment.ConventionProcessor.RunInstallConventions() in Y:\work\b1fd300731d5f2fc\source\Calamari\Deployment\ConventionProcessor.cs:line 60
14:28:48Error
at Calamari.Deployment.ConventionProcessor.RunConventions() in Y:\work\b1fd300731d5f2fc\source\Calamari\Deployment\ConventionProcessor.cs:line 28
14:28:48Error
Running rollback conventions…
14:28:48Error
System.ArgumentException: Part URI is not valid per rules defined in the Open Packaging Conventions specification.
14:28:48Error
at System.IO.Packaging.Package.GetPartHelper(Uri partUri)
14:28:48Error
at Microsoft.ServiceHosting.Tools.Packaging.ServicePackageBase.GetPart(Uri partUri)
14:28:48Error
at Microsoft.WindowsAzure.Packaging.PackageConverter.AddSoftwarePackageToLayout(PackageBuilder builder, String layoutPath, ServiceSoftwarePackage softwarePacakge)
14:28:48Error
at Microsoft.WindowsAzure.Packaging.PackageConverter.ConvertFromLegacy(Stream srcPackage, PackageStore dstPackage, X509Certificate2 decrypt, PackageRestrictions restrictions)
14:28:48Error
at Calamari.Azure.Deployment.Conventions.EnsureCloudServicePackageIsCtpFormatConvention.ConvertPackage(String packagePath) in Y:\work\b1fd300731d5f2fc\source\Calamari.Azure\Deployment\Conventions\EnsureCloudServicePackageIsCtpFormatConvention.cs:line 48
14:28:48Error
at Calamari.Azure.Deployment.Conventions.EnsureCloudServicePackageIsCtpFormatConvention.Install(RunningDeployment deployment) in Y:\work\b1fd300731d5f2fc\source\Calamari.Azure\Deployment\Conventions\EnsureCloudServicePackageIsCtpFormatConvention.cs:line 38
14:28:48Error
at Calamari.Deployment.ConventionProcessor.RunInstallConventions() in Y:\work\b1fd300731d5f2fc\source\Calamari\Deployment\ConventionProcessor.cs:line 60
14:28:48Error
at Calamari.Deployment.ConventionProcessor.RunConventions() in Y:\work\b1fd300731d5f2fc\source\Calamari\Deployment\ConventionProcessor.cs:line 50
14:28:48Error
at Calamari.Azure.Commands.DeployAzureCloudServiceCommand.Execute(String[] commandLineArguments) in Y:\work\b1fd300731d5f2fc\source\Calamari.Azure\Commands\DeployAzureCloudServiceCommand.cs:line 93
14:28:48Error
at Calamari.Program.Execute(String[] args) in Y:\work\b1fd300731d5f2fc\source\Calamari\Program.cs:line 27
14:28:49Fatal
The step failed: The remote script failed with exit code 100

Hi, thanks for getting in touch, and sorry for the trouble you are having with this feature.

It seems like one of the files inside the .cspkg isn’t valid when we try to add it back.

Would it be possible for you to:

  • Find the .cspkg that you are deploying
  • Make a copy of it, and change the extension to .zip
  • Send us a list of all of the files inside the zip (a screenshot would be fine)

Alternatively, if it’s possible, you could send us a copy of the .cspkg (you can email it to me directly, paul at octopusdeploy.com) and I can take a look. I understand if you aren’t able to do this however.

Paul

Hi Paul,

I’ve attached two screenshots of the files containing in the .cspkg package root level and the folder _rels.

Hope this will be helpful.

Sachith

octopus_partURI_Issue_Inside_cspkg_inside_rels_folder.jpg

Hi Sachith,

Thanks for sending the package through, it was a great help. The root error appears to be that the web site you’re deploying to Azure cloud service contains files with names like this:

/sitesroot/0/.../EditorTemplates/Byte[].cshtml

During deployment, we attempt to convert the cloud service from the legacy format to a new format for Azure cloud services. To do that, we call some Microsoft code to do the conversion (a class called PackageConverter). It seems that there is a bug in the way it handles URI’s, and these URI’s are not “well formed” (a URI with ‘[’ in it isn’t valid, apparently), causing it to fail. Interestingly, you can create packages with these names without a problem.

We’ll see if there’s a newer version of the package conversion code we can use, and otherwise we’ll follow up with our contacts at Microsoft to see if there’s a workaround or if we can get it fixed.

In the mean time, there are two options:

  1. Rename the files to remove the []'s. I’m not sure if there are other conventions you can use with MVC to keep the array syntax out of the file name.
  2. Disable package extraction in Octopus. This means that we won’t be able to run transforms on your web.config files or change web.config settings, but we can still make changes to .cscfg.

To disable package extraction, create a new variable for your project in Octopus with the following name:

Octopus.Action.Azure.CloudServicePackageExtractionDisabled

And set the value to True.

Thanks for waiting and sorry for the bad news, hope this helps!

Paul

Hi Paul,

Thanks for the support!, it resolved the issue and works as expected.

Sachith