Powershell 使用带有NuGet上游源的Azure DevOps工件源安装包失败 问题
我正在尝试从公共存储库安装程序包。我想使用PackageSourcePowershell 使用带有NuGet上游源的Azure DevOps工件源安装包失败 问题,powershell,tfs,azure-devops,nuget,azure-artifacts,Powershell,Tfs,Azure Devops,Nuget,Azure Artifacts,我正在尝试从公共存储库安装程序包。我想使用PackageSource外部。这是一个Azure DevOps工件提要,配置为NuGet Gallery作为上游源。由于NuGet Gallery是一个上游源,因此我对包的请求应该通过工件并由上游源完成,但它会出错并说没有匹配项 另一方面,如果我使用直接指向NuGet Gallery的PackageSource提交相同的请求,它就可以工作。工件中的上游源功能会被破坏吗 包源 使用Azure DevOps工件包源安装包(失败) 使用NuGet Gal
外部
。这是一个Azure DevOps工件提要,配置为NuGet Gallery作为上游源
。由于NuGet Gallery是一个上游源,因此我对包的请求应该通过工件并由上游源完成,但它会出错并说没有匹配项
另一方面,如果我使用直接指向NuGet Gallery的PackageSource提交相同的请求,它就可以工作。工件中的上游源功能会被破坏吗
包源 使用Azure DevOps工件包源安装包(失败) 使用NuGet Gallery软件包源安装软件包(成功)
上游源功能在我这边运行良好。但是,我在安装包期间没有得到此促销信息
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
这似乎与您的本地安全设置有关。不知道如何启用或禁用。然而,根据你的描述和情况。在我看来,我想知道在您使用Azure DevOps Artifacts包源安装包的过程中是否有跳转
因为与直接连接NuGet Gallery不同,您需要首先访问Azure DevOps工件提要,然后通过上游源获取该包。您无法选择信任信息,它选择默认值(默认值为“否”)。最后,您无法安装该软件包
您可以关闭本地安全设置,然后再试一次,这可能会起作用。如果由于策略原因,您无法将其关闭
作为一种解决方法,您可以在“上游关闭”的情况下创建一个需求提要,并将您的包作为包源上传到提要中 所以在做了一些额外的测试之后,我确实发现在
Install命令
cmdlet失败的地方,使用nuget.exe
CLI是可行的
不幸的是,我仍然不能完全确定为什么会发生这种行为
下面是我的安装包版本
>Get-Command -name 'Install-Package'
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Install-Package 1.4.3 PackageManagement
还有我的nuget.exe版本
>nuget
NuGet Version: 5.2.0.6090
最后,这里是nuget.exe
命令的输出
[C:\Users\srz\]
>nuget install Microsoft.Extensions.Primitives -Version 3.0.1 -Source "External"
Feeds used:
C:\Users\srz\.nuget\packages\
http://azuredevops/Development/_packaging/External/nuget/v3/index.json
Attempting to gather dependency information for package 'Microsoft.Extensions.Primitives.3.0.1' with respect to project 'C:\Users\srz', targeting 'Any,Version=v0.0'
Gathering dependency information took 651.6 ms
Attempting to resolve dependencies for package 'Microsoft.Extensions.Primitives.3.0.1' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.Extensions.Primitives.3.0.1'
Resolved actions to install package 'Microsoft.Extensions.Primitives.3.0.1'
Retrieving package 'Microsoft.Extensions.Primitives 3.0.1' from 'External'.
GET http://azuredevops/Development/_packaging/abc123/nuget/v3/flat2/microsoft.extensions.primitives/3.0.1/microsoft.extensions.primitives.3.0.1.nupkg
OK http://azuredevops/Development/_packaging/abc123/nuget/v3/flat2/microsoft.extensions.primitives/3.0.1/microsoft.extensions.primitives.3.0.1.nupkg 229ms
Installing Microsoft.Extensions.Primitives 3.0.1.
Adding package 'Microsoft.Extensions.Primitives.3.0.1' to folder 'C:\Users\srz'
Added package 'Microsoft.Extensions.Primitives.3.0.1' to folder 'C:\Users\srz'
Successfully installed 'Microsoft.Extensions.Primitives 3.0.1' to C:\Users\srz
Executing nuget actions took 635.5 ms
谢谢你的回复,帕特里克!经过一些额外的测试,并使用更改为使用
nuget.exe
命令来安装软件包,而不是install-package
,它现在似乎可以工作了。我猜我的Install-Package
cmdlet可能是一个比较老的挑剔版本。我将在回答中写下这一点,但我仍然不能完全确定为什么安装包失败,但nuget.exe安装工作正常。它似乎与nuget.exe
或Install-Package
命令无关。有时feed不会很快更新,从上游包源获取更新需要时间(可能需要一个小时)。
>Get-Command -name 'Install-Package'
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Install-Package 1.4.3 PackageManagement
>nuget
NuGet Version: 5.2.0.6090
[C:\Users\srz\]
>nuget install Microsoft.Extensions.Primitives -Version 3.0.1 -Source "External"
Feeds used:
C:\Users\srz\.nuget\packages\
http://azuredevops/Development/_packaging/External/nuget/v3/index.json
Attempting to gather dependency information for package 'Microsoft.Extensions.Primitives.3.0.1' with respect to project 'C:\Users\srz', targeting 'Any,Version=v0.0'
Gathering dependency information took 651.6 ms
Attempting to resolve dependencies for package 'Microsoft.Extensions.Primitives.3.0.1' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.Extensions.Primitives.3.0.1'
Resolved actions to install package 'Microsoft.Extensions.Primitives.3.0.1'
Retrieving package 'Microsoft.Extensions.Primitives 3.0.1' from 'External'.
GET http://azuredevops/Development/_packaging/abc123/nuget/v3/flat2/microsoft.extensions.primitives/3.0.1/microsoft.extensions.primitives.3.0.1.nupkg
OK http://azuredevops/Development/_packaging/abc123/nuget/v3/flat2/microsoft.extensions.primitives/3.0.1/microsoft.extensions.primitives.3.0.1.nupkg 229ms
Installing Microsoft.Extensions.Primitives 3.0.1.
Adding package 'Microsoft.Extensions.Primitives.3.0.1' to folder 'C:\Users\srz'
Added package 'Microsoft.Extensions.Primitives.3.0.1' to folder 'C:\Users\srz'
Successfully installed 'Microsoft.Extensions.Primitives 3.0.1' to C:\Users\srz
Executing nuget actions took 635.5 ms