【发布时间】:2020-03-16 17:04:33
【问题描述】:
问题
我正在尝试从公共存储库安装软件包。我想使用 PackageSource External。这是一个 Azure DevOps 工件源,使用 NuGet 库 配置为 Upstream source。由于 NuGet Gallery 是上游源,我对包的请求应该通过 Artifacts 并由上游源完成,但它会出错并说不匹配。
另一方面,如果我使用直接指向 NuGet Gallery 的 PackageSource 提交相同的请求,它就可以工作。 Artifacts 中的上游源功能会被破坏吗?
包源
[D:\MySandboxes\TFS\Development\DevOps\]
>Get-PackageSource
Name ProviderName IsTrusted Location
---- ------------ --------- --------
Microsoft Visual Studio Offli... NuGet False C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Internal NuGet False http://azuredevops/Development/_packaging/Internal/nuget/v3/index.json
External NuGet False http://azuredevops/Development/_packaging/External/nuget/v3/index.json
MyNuGet NuGet False https://www.nuget.org/api/v2
PSGallery PowerShellGet False https://www.powershellgallery.com/api/v2
使用 Azure DevOps Artifacts 包源安装包(失败)
[D:\MySandboxes\TFS\Development\DevOps\]
>Install-Package Resta.UriTemplates -Source External -Destination "."
Install-Package : No match was found for the specified search criteria and package name 'Resta.UriTemplates'. Try Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Install-Package Resta.UriTemplates -Source External -Destination "."
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
使用 NuGet Gallery 包源安装包(成功)
[D:\MySandboxes\TFS\Development\DevOps\]
>Install-Package Resta.UriTemplates -Source MyNuGet -Destination "."
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'MyNuGet'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "No"): a
Name Version Source Summary
---- ------- ------ -------
Resta.UriTemplates 1.3.0 MyNuGet .NET implementation of the URI template spec (RFC6570). Supports up to level 4 template expressions.
【问题讨论】:
标签: powershell tfs azure-devops nuget azure-artifacts