[英]Azure DevOps: Can not load nuget package from feed in Azure Pipeline
In my Azure DevOps organization i have 2 Project: Project 1: Some Tools Project 2: My Application在我的 Azure DevOps 组织中,我有 2 个项目:项目 1:一些工具项目 2:我的应用程序
The Build Result from Project 1 is published to a feed in Project 1. In VS2019 I can use the nuget package from that feed in my application in Project 2. When I try to setup a pipeline for Project 2 I can not load the packages from project 1.项目 1 的构建结果发布到项目 1 中的提要。在 VS2019 中,我可以在项目 2 的应用程序中使用该提要中的 nuget 包。当我尝试为项目 2 设置管道时,我无法从中加载包项目 1.
My Pipeline looks like:我的管道看起来像:
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)'
The nuget restore fails with the error: 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: ...)).
Am I missing any configuration?我缺少任何配置吗?
To use packages from a feed in Azure Pipelines, the appropriate build identity must have permission to your feed.
若要在 Azure Pipelines 中使用源中的包,相应的生成标识必须具有对源的权限。 By default, the Project Collection Build Service is a Contributor.
默认情况下,项目集合构建服务是一个贡献者。 If you've changed your builds to run at project scope, you'll need to add the project-level build identity as a Reader or Contributor, as desired.
如果您已将构建更改为在项目范围内运行,则需要根据需要将项目级构建标识添加为读者或贡献者。 The project-level build identity is named as follows:
项目级构建标识命名如下:
[Project name] Build Service ([Organization name]) (eg FabrikamFiber Build Service (codesharing-demo))
[项目名称] 构建服务([组织名称])(例如 FabrikamFiber 构建服务(代码共享演示))
https://docs.microsoft.com/en-us/azure/devops/artifacts/feeds/feed-permissions?view=azure-devops#package-permissions-in-azure-pipelines https://docs.microsoft.com/en-us/azure/devops/artifacts/feeds/feed-permissions?view=azure-devops#package-permissions-in-azure-pipelines
Azure DevOps: Can not load nuget package from feed in Azure Pipeline
Azure DevOps:无法从 Azure Pipeline 中的提要加载 nuget 包
There is known issue about the project scope feed.项目范围提要存在已知问题。 Microsoft recently changed the default scope level for new feeds to Project instead of Organization.
Microsoft 最近将新提要的默认范围级别更改为 Project 而不是 Organization。
So, you need to check if your feed is project scope feed or Organization scope feed.因此,您需要检查您的提要是项目范围提要还是组织范围提要。 If it is Organization scope feed, you need to check if azure devops login account has permission to access the feed.
如果是Organization scope feed,需要检查azure devops登录账号是否有权限访问feed。
If the feed is project scope feed, you could try to use vstsFeed:<yourProjectName>/<yourFeedName>
or add the project-level build identity as a Reader or Contributor.如果提要是项目范围提要,您可以尝试使用
vstsFeed:<yourProjectName>/<yourFeedName>
或将项目级构建标识添加为读者或贡献者。
Check this similar thread for some more details.检查此类似线程以获取更多详细信息。
Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.