[英]Azure DevOps dotnet restore task fails due to wrong URL format on Nuget artifact feed
[英]Nuget restore not working with artifact feed in Azure Devops
NuGet 从同一组织中的另一个项目上恢复失败 404。
使用nuget restore
时,找不到不同项目中的提要。
经过长时间的搜索,这些是使其始终如一地工作所必需的步骤:
设置权限
设置构建管道
nuget.config file
并确保将其签入feedsToUse
设置为'config'
azure-pipelines.yml
- task: DotNetCoreCLI@2
displayName: DotNetCore-Restore
inputs:
command: 'restore'
projects: '$(PathToSolution)'
feedsToUse: 'config'
nugetConfigPath: '$(PathToNugetConfig)/nuget.config'
includeNuGetOrg: true
nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="feed_name" value="feed_url" />
</packageSources>
</configuration>
不需要向管道添加身份验证任务,因为 do.net 命令会自行执行此操作......但是:
大多数 do.net 命令,包括构建、发布和测试,都包含一个隐式恢复步骤。 即使您在前面的步骤中成功运行了 do.net 还原,这对于经过身份验证的提要也会失败,因为前面的步骤已经清除了它使用的凭据。
您可以参考此文档来设置 Azure Artifacts Credential Provider,以便在各种工具中使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.