1
votes

I created a private NuGet feed in Azure DevOps following this guide and created a build pipeline with dotnet pack and dotnet nuget push steps. After running the build a few times, the new versions are displayed under Artifacts >> MyFeed >> Versions. I promoted some of the versions by hand to @Release.

Here's the view in DevOps: DevOps NuGet feed details

But when I connect to the feed in Visual Studio, I only see version 1.0.0 as stable release, but all later versions (which are published via my build pipeline), are only shown if I check the "include pre-release" option. Here's a screenshot:

Visual Studio NuGet package details

My questions are:

1 - how can I manually promote a version to stable?
2 - how can I promote a version to stable via a build or release pipeline?

2

2 Answers

1
votes

NuGet uses Semantic Versioning 2.0, which says that anything after a - character signals pre-release information. Therefore 1.0.1-CI is prerelease, whereas 1.0.1 would be a release version. If you want build metadata in the version string, you should use the + character, again as defined by SemVer2.

edit: note that SemVer metadata does not contribute to version comparisons, so 1.2.3+CI.1 is considered the SAME version as 1.2.3+CI.2

1
votes

Azure DevOps - Private NuGet feed doesn't update stable release

Just like zivkan said "anything after a - character signals pre-release information.". You can check the nuget document Package versioning for some details.

1 - how can I manually promote a version to stable?

You can download that package from your nuget feed, then change the package version to stable, then re-push it to the feed.

2 - how can I promote a version to stable via a build or release pipeline?

To promote a version to stable via a build or release, you could change the build number. When you use dotnet pack task to create the nuget package, there is an option Automatic package versioning:

enter image description here

Update:

So, try to use the option Use the build number option on the Automatic package versioning.

Then, in the Build number format option, you can set it to $(Major).$(Minor).$(Patch)$(Rev:.r):

enter image description here

The value of $(Major), $(Minor), $(Patch) are custom variables in the Variables tab, the value of $(Rev:.r) is the build number.

In this case, the package will be TestSample.1.0.0.5.nupkg.

Hope this helps.