首页 > 解决方案 > Octopus 下载包错误:根据开放打包约定规范中定义的规则,部分 URI 无效

问题描述

我已经将一个包上传到我们的 nuget 提要中,并且在我们的过程中有一个包部署任务,但是获取包步骤失败并出现以下错误:

Downloading NuGet package <Package> from feed: 'http://feed/nuget/Default'
15:11:42Error
Unable to download package: Part URI is not valid per rules defined in the Open Packaging Conventions specification.
15:11:42Error
Failed to download package <Package> from feed: 'http://feed/nuget/Default'
15:11:42Error
System.Exception: The package could not be downloaded from NuGet. If you are getting a package verification error, try switching to a Windows File Share package repository to see if that helps.
15:11:42Error
   at Calamari.Integration.PackageDownload.PackageDownloader.AttemptToDownload(String packageId, SemanticVersion version, Uri feedUri, String cacheDirectory, String& downloadedTo, IPackage& downloaded) in Z:\BuildAgent\work\14ffc968155e4956\source\Calamari\Integration\PackageDownload\PackageDownloader.cs:line 146
15:11:42Error
   at Calamari.Integration.PackageDownload.PackageDownloader.DownloadPackage(String packageId, SemanticVersion version, String feedId, Uri feedUri, Boolean forcePackageDownload, String& downloadedTo, String& hash, Int64& size) in Z:\BuildAgent\work\14ffc968155e4956\source\Calamari\Integration\PackageDownload\PackageDownloader.cs:line 45
15:11:42Error
   at Calamari.Commands.DownloadPackageCommand.Execute(String[] commandLineArguments) in Z:\BuildAgent\work\14ffc968155e4956\source\Calamari\Commands\DownloadPackageCommand.cs:line 59

查看原始日志,我可以看到:

                |       Running: Download package Sitecore version 8.2.2 from 

http://feed/nuget/Default
14:09:33   Verbose  |         Octopus Deploy: Calamari version 3.3.32+Branch.master.Sha.d4b60a3db38fae9b6afdec2d088705a7689dfb08
14:09:33   Verbose  |         Name                           Value
14:09:33   Verbose  |         ----                           -----
14:09:33   Verbose  |         PSVersion                      5.0.10586.117
14:09:33   Verbose  |         PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
14:09:33   Verbose  |         BuildVersion                   10.0.10586.117
14:09:33   Verbose  |         CLRVersion                     4.0.30319.42000
14:09:33   Verbose  |         WSManStackVersion              3.0
14:09:33   Verbose  |         PSRemotingProtocolVersion      2.3
14:09:33   Verbose  |         SerializationVersion           1.1.0.1
14:09:33   Verbose  |         Octopus Deploy: Calamari version 3.3.32+Branch.master.Sha.d4b60a3db38fae9b6afdec2d088705a7689dfb08
14:09:33   Verbose  |         Checking package cache for package <Package>
14:09:33   Info     |         Downloading NuGet package <Package> from feed: 'http://feed/nuget/Default'
14:09:33   Verbose  |         Downloaded package will be stored in: 'C:\Octopus\Files\feeds-'
14:09:33   Verbose  |         Finding package (attempt 1 of 5)
14:09:33   Verbose  |         Found package Sitecore version 8.2.2
14:09:33   Verbose  |         Downloading to: C:\Octopus\Files\feeds-\<Package>_E5E7A496910166469362029C4D3EBA0F.nupkg
14:09:33   Verbose  |         A direct download is possible; bypassing the NuGet machine cache
14:09:33   Verbose  |         Attempt 1 of 5: Unable to download package: Part URI is not valid per rules defined in the Open Packaging Conventions specification.
14:09:33   Verbose  |         Finding package (attempt 2 of 5)
14:09:33   Verbose  |         Found package Sitecore version 8.2.2
14:09:33   Verbose  |         Downloading to: C:\Octopus\Files\feeds-\<Package>_F85FDFD2EF823C41BDBB00C7F0EB1542.nupkg
14:09:33   Verbose  |         A direct download is possible; bypassing the NuGet machine cache
14:10:12   Verbose  |         Attempt 2 of 5: Unable to download package: Part URI is not valid per rules defined in the Open Packaging Conventions specification.
14:10:17   Verbose  |         Finding package (attempt 3 of 5)
14:10:17   Verbose  |         Found package Sitecore version 8.2.2
14:10:17   Verbose  |         Downloading to: C:\Octopus\Files\feeds-\<Package>_15F1514B91F27942A9EF470B11369AA7.nupkg
14:10:17   Verbose  |         A direct download is possible; bypassing the NuGet machine cache
14:10:47   Verbose  |         Attempt 3 of 5: Unable to download package: Part URI is not valid per rules defined in the Open Packaging Conventions specification.
14:10:52   Verbose  |         Finding package (attempt 4 of 5)
14:10:52   Verbose  |         Found package Sitecore version 8.2.2
14:10:52   Verbose  |         Downloading to: C:\Octopus\Files\feeds-\<Package>_3A117290B32E084485CBC25FA4D17611.nupkg
14:10:52   Verbose  |         A direct download is possible; bypassing the NuGet machine cache
14:11:32   Verbose  |         Attempt 4 of 5: Unable to download package: Part URI is not valid per rules defined in the Open Packaging Conventions specification.
14:11:32   Verbose  |         Finding package (attempt 5 of 5)
14:11:32   Verbose  |         Found package Sitecore version 8.2.2
14:11:32   Verbose  |         Downloading to: C:\Octopus\Files\feeds-\<Package>_E78C9F7C3950E6449F88B98A13C966A2.nupkg
14:11:32   Verbose  |         A direct download is possible; bypassing the NuGet machine cache
14:11:37   Verbose  |         Attempt 5 of 5: Unable to download package: Part URI is not valid per rules defined in the Open Packaging Conventions specification.
14:11:42   Error    |         Unable to download package: Part URI is not valid per rules defined in the Open Packaging Conventions specification.
14:11:42   Error    |         Failed to download package <Package> from feed: 'http://feed/nuget/Default'
14:11:42   Error    |         System.Exception: The package could not be downloaded from NuGet. If you are getting a package verification error, try switching to a Windows File Share package repository to see if that helps.
14:11:42   Error    |         at Calamari.Integration.PackageDownload.PackageDownloader.AttemptToDownload(String packageId, SemanticVersion version, Uri feedUri, String cacheDirectory, String& downloadedTo, IPackage& downloaded) in Z:\BuildAgent\work\14ffc968155e4956\source\Calamari\Integration\PackageDownload\PackageDownloader.cs:line 146
14:11:42   Error    |         at Calamari.Integration.PackageDownload.PackageDownloader.DownloadPackage(String packageId, SemanticVersion version, String feedId, Uri feedUri, Boolean forcePackageDownload, String& downloadedTo, String& hash, Int64& size) in Z:\BuildAgent\work\14ffc968155e4956\source\Calamari\Integration\PackageDownload\PackageDownloader.cs:line 45
14:11:42   Error    |         at Calamari.Commands.DownloadPackageCommand.Execute(String[] commandLineArguments) in Z:\BuildAgent\work\14ffc968155e4956\source\Calamari\Commands\DownloadPackageCommand.cs:line 59

如果我登录到 tentacle,我可以看到包被多次下载。

是什么导致了错误?

标签: nuget-packageoctopus-deploy

解决方案


这最终成为我用来创建包的 NuGet 版本(最新)和 Octopus 版本(非常旧)的兼容性问题。

为了解决这个问题,我下载了旧2.8.6版本的 NuGet 并使用pack命令生成包。这解决了这个问题。


推荐阅读