[英]Nuget restore not working with artifact feed in Azure Devops
NuGet restore fails 404 from feed on another project in same organization. NuGet 从同一组织中的另一个项目上恢复失败 404。
When using nuget restore
from a pipeline the feed inside a different project is not found.使用
nuget restore
时,找不到不同项目中的提要。
After searching for a long time, these are the steps necessary to make it work consistently:经过长时间的搜索,这些是使其始终如一地工作所必需的步骤:
Setup permissions设置权限
Setup build pipeline设置构建管道
nuget.config file
and make sure to check it innuget.config file
并确保将其签入feedsToUse
to 'config'
feedsToUse
设置为'config'
azure-pipelines.yml azure-pipelines.yml
- task: DotNetCoreCLI@2
displayName: DotNetCore-Restore
inputs:
command: 'restore'
projects: '$(PathToSolution)'
feedsToUse: 'config'
nugetConfigPath: '$(PathToNugetConfig)/nuget.config'
includeNuGetOrg: true
nuget.config nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="feed_name" value="feed_url" />
</packageSources>
</configuration>
There is no need to add an authenticate task to the pipeline as the do.net command does this by itself... However:不需要向管道添加身份验证任务,因为 do.net 命令会自行执行此操作......但是:
Most do.net commands, including build, publish, and test include an implicit restore step.
大多数 do.net 命令,包括构建、发布和测试,都包含一个隐式恢复步骤。 This will fail against authenticated feeds, even if you ran a successful do.net restore in an earlier step, because the earlier step will have cleaned up the credentials it used.
即使您在前面的步骤中成功运行了 do.net 还原,这对于经过身份验证的提要也会失败,因为前面的步骤已经清除了它使用的凭据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.