Publishing a NuGet package in Azure Artifacts, in a project-scoped feed
For a long time, it's been possible to create and share package feeds (NuGet and others) in Azure Artifacts.
While it used to be a relatively expensive option, with the changes made to service pricing over the past year, using the service has become a total no-brainer. 2 GB for free is enough to store a lot of packages!
This relates to a situation I faced recently where, due to the current documentation's deficiencies, I spent an hour just setting up a build/deploy pipeline for NuGet packages.
In this case, the publishing would be done in a project-scoped feed instead of an organization-scoped feed.
As YAML configuration has become the standard, whether we like it or not, my publishing step ended up looking something like this:
1- task: NuGetCommand@2
2 displayName: 'Push Release Package'
3 inputs:
4 command: 'push'
5 packagesToPush: '$(Pipeline.Workspace)/packages/release/*.nupkg'
6 nuGetFeedType: 'internal'
7 publishVstsFeed: 'MYFEED'
It should work, right?
Of course not. This only works if MYFEED is defined at the organization level.
If the feed is project-scoped, the value of 'publishVstsFeed' has to take the format PROJECT/FEED
1- task: NuGetCommand@2
2 displayName: 'Push Release Package'
3 inputs:
4 command: 'push'
5 packagesToPush: '$(Pipeline.Workspace)/packages/release/*.nupkg'
6 nuGetFeedType: 'internal'
7 publishVstsFeed: 'PROJECT/MYFEED'