简体   繁体   English

带有 Azure DevOps Artifacts feed 的 NuGet 上游源的安装包失败

[英]Install-Package with Azure DevOps Artifacts feed with NuGet upstream source is failing

Problem问题

I'm attempting to install a package from a public repository.我正在尝试从公共存储库安装 package。 I want to use the PackageSource External .我想使用 PackageSource External This is a Azure DevOps Artifacts Feed that is configured with NuGet Gallery as an Upstream source .这是一个Azure DevOps Artifacts Feed ,配置了NuGet 库作为Upstream source Since NuGet Gallery is an upstream source, my request for a package should pass through Artifacts and be fulfilled by the Upstream source, but instead it errors and says that there's no match.由于 NuGet Gallery 是上游源,我对 package 的请求应该通过 Artifacts 并由上游源实现,但它会出错并说没有匹配项。

On the other hand, if I submit the same request using a PackageSource that is pointing directly to NuGet Gallery, it works.另一方面,如果我使用直接指向 NuGet Gallery 的 PackageSource 提交相同的请求,则它可以工作。 Could the Upstream source functionality in Artifacts be broken? Artifacts 中的上游源功能会被破坏吗?


在此处输入图像描述

Package sources Package 来源

[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

Installing package with Azure DevOps Artifacts package source (fails)使用 Azure DevOps 工件 package 源安装 package(失败)

[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

Installing package with NuGet Gallery package source (succeeds)安装 package 与 NuGet 库 package 源(成功)

[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.

The Upstream source feature works well in my side.上游源功能在我这边运行良好。 However, I didn't get this promote info during install package.但是,在安装 package 期间,我没有收到此促销信息。

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

This seems related to your local security setting.这似乎与您的本地安全设置有关。 Have no idea how to enable or disable.不知道如何启用或禁用。 However, according to your description and situation.不过根据你的描述和情况。 In my opinion, I was wondering if there is a jump during your installing package with Azure DevOps Artifacts package source.在我看来,我想知道在您使用 Azure DevOps Artifacts package 源安装 package 期间是否有跳跃。

Since unlike directly connect NuGet Gallery, you need first access Azure DevOps Artifacts Feed first, then through upstream source to fetch that package.由于不像直接连接 NuGet Gallery,您需要先访问 Azure DevOps Artifacts Feed,然后通过上游源获取 package。 You could not select the trust info, it choose default (default is "No").您不能 select 信任信息,它选择默认(默认为“否”)。 Finally, you could not install that package.最后,您无法安装 package。

You could turn off your local security setting and try it again, which may do trick.您可以关闭本地安全设置并重试,这可能会奏效。 If due to policy, you could not turn it off.如果由于政策原因,您无法将其关闭。

As a workaround, you could create a need feed with upstream off and upload your package in feed as package source.作为一种解决方法,您可以在上游关闭的情况下创建需求提要,并将 package 作为 package 源上传到提要中。

So after doing some additional testing, I did discover that using the nuget.exe CLI worked where the Install-Command cmdlet was failing me.因此,在进行了一些额外的测试之后,我确实发现使用nuget.exe CLI 可以在Install-Command cmdlet 失败的情况下工作。

I'm unfortunately still not entirely sure why this behavior is happening.不幸的是,我仍然不完全确定为什么会发生这种行为。

Below is my version of Install-Package下面是我的Install-Package版本

>Get-Command -name 'Install-Package'

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Install-Package                                    1.4.3      PackageManagement

And also my version of nuget.exe还有我的nuget.exe版本

>nuget
NuGet Version: 5.2.0.6090

Finally, here's output from the nuget.exe command succeeding.最后,这里的 output 来自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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Nuget的Powershell安装包 - Powershell Install-Package from Nuget Install-Package&NuGet Package安装位置 - 安装到哪里? - Install-Package & NuGet Package install location - where installed to? “nuget install”,“Install-Package”和“choco install”有什么区别? - What is the difference betwee “nuget install” , “Install-Package” and “choco install”? 运行 install-package 而不提示安装 nuget - run install-package without it prompting to install nuget NuGet [Install-Package],NotImplementedException尝试安装软件包或创建mvc 3项目 - NuGet [Install-Package], NotImplementedException attempting package install or mvc 3 project creation 如何使用nuget.org的OneGet / install-package安装软件包 - How do I install a package using OneGet / install-package from nuget.org Find-Package 有效,但 Install-Package 在 powershell 中使用 Chocolatey 仅显示 nuget 错误 - Find-Package works but Install-Package shows only nuget error using chocolatey in powershell Nuget.exe push **\*.nupkg & Azure DevOps 工件 - Nuget.exe push **\*.nupkg & Azure DevOps Artifacts 如何在正常的PowerShell会话中(不在Visual Studio中)运行Nuget PowerShell cmdlet Install-Package? - How can I run Nuget PowerShell cmdlet Install-Package in normal PowerShell session (not inside Visual Studio)? VS2015 - NuGet 安装包:Base-64 字符数组或字符串的长度无效 - VS2015 - NuGet Install-Package : Invalid length for a Base-64 char array or string
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM