NuGet restore fails 404 from feed on another project in same organization.
When using nuget restore
from a pipeline the feed inside a different project is not found.
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 infeedsToUse
to '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>
There is no need to add an authenticate task to the pipeline as the do.net command does this by itself... However:
Most do.net commands, including build, publish, and test include an implicit restore step. 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.
You can refer to this doc to setup Azure Artifacts Credential Provider for usage across various tooling.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.