Azure DevOps:无法从 Azure Pipeline 中的源加载 nuget 包

Geo*_* H. 5 azure nuget azure-devops azure-pipelines

在我的 Azure DevOps 组织中,我有 2 个项目: 项目 1:一些工具 项目 2:我的应用程序

项目 1 的构建结果发布到项目 1 中的 feed。在 VS2019 中,我可以在项目 2 的应用程序中使用该 feed 中的 nuget 包。当我尝试为项目 2 设置管道时,我无法从项目1.

我的管道看起来像:

steps:
- task: NuGetAuthenticate@0
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    vstsFeed: ***FEED_ID***
- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

Run Code Online (Sandbox Code Playgroud)

nuget 恢复失败并出现以下错误:

##[error]The nuget command failed with exit code(1) and error(Unable to load the service index for source https://***organization***.pkgs.visualstudio.com/***FEED_ID***/_packaging/***PACKAGE_ID***/nuget/v3/index.json.
  Response status code does not indicate success: 404 (Not Found - VS800075: The project with id 'vstfs:///Classification/TeamProject/FEED_ID' does not exist, or you do not have permission to access it. (DevOps Activity ID: ...)).

Run Code Online (Sandbox Code Playgroud)

我是否缺少任何配置?

Leo*_*SFT 3

Azure DevOps:无法从 Azure Pipeline 中的源加载 nuget 包

项目范围提要存在已知问题。Microsoft 最近将新源的默认范围级别更改为“项目”而不是“组织”。

因此,您需要检查您的 Feed 是项目范围 Feed 还是组织范围 Feed。如果是组织范围的 feed,则需要检查 azure devops 登录帐户是否有权访问该 feed。

在此输入图像描述

如果提要是项目范围提要,您可以尝试使用vstsFeed:<yourProjectName>/<yourFeedName>或添加项目级构建身份作为读者或贡献者。

检查这个类似的线程以获取更多详细信息。

希望这可以帮助。

  • 谢谢你的评论。它终于起作用了,但我还必须将构建用户添加到项目中。仅授予提要权限是不够的。 (5认同)
  • @JamesLaw 您在组织下设置的每个项目都有自己的构建用户帐户。因此,如果您在 Project Vanilla 下有一个工件,而 Project Chocolate 试图在其某个构建中使用该工件,则您需要在 Vanilla 项目设置下的权限中将 Chocolate 构建服务添加为构建管理员。感谢 Georg H 的评论。这也让我摆脱了困境。 (5认同)