NuGet还原无法从Feed中读取相同组织中的另一个项目404。
在管道中使用nuget restore
时,找不到其他项目中的feed。
答案 0 :(得分:3)
搜索了很长一段时间后,这些是使其始终如一地工作的必要步骤:
设置权限
设置构建管道
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>
不需要将验证任务添加到管道中,因为dotnet命令本身可以完成此任务...但是:
大多数dotnet命令(包括构建,发布和测试)都包含一个 隐式还原步骤。这将无法通过经过验证的供稿, 即使您在较早的步骤中成功运行了dotnet还原, 因为前面的步骤将清除它使用的凭据。
-Source (.NET Core CLI task docs)
答案 1 :(得分:0)
您可以参考this文档来设置Azure Artifacts凭据提供程序以在各种工具中使用。