Create a feed of the Azure Artifact
Go to the Artifacts and create new feed. Just give it name and hit Create. Then you will see the new repository for NuGet Package.
Create a build pipeline
You might automate the build/pack/publish to NuGet.
For the development environment, we don’t want version up the semantic version, however, if we build a new build, we want to distinguish it by using BUILD_ID of the Azure DevOps. Let’s add $(VersionSuffix) on your csproj file, Version section.
For the production, it become blank since the $(VersionSuffix) is not set. however, for development environment, I’d like to make it like
0.0.1-alpha-22 and cleary change the name not for hit cache and update build everytime. 21 and 22 will be the BUILD_ID of the pipeline. If you add
-rc , it becomes pre-release.
The pipeline is almost the same as the template of Asp .NET Core. I change little bit for it.
The point is, In case of build, you can specify the
--version-suffix option with the parameter “-$(Build.BuildId)” It will overwrite the
$(VersionSuffix) by the Build_ID of the CI pipeline.
Also, you need to add the Version Suffix on pack. If you are using GUI, you can go Advanced tab to configure it.
BTW, I still prefer to start with classic GUI. It is very easy and eventually it can convert into yaml if necessary. Also, we can use template which is well defined. In this case, we can choose the Artifacts feed with drop down menu.
Now your Nuget Package is upload to the Artifacts
If you queue build, you will see the new version is upload to the Artifacts.
If you click Connect to feed, you can see the Connection information to this repo.
Configure the package source.
Then you will see all NuGet package for all build_id.
Creating a repository for Nuget Package is pretty easy with Azure DevOps. 🙂
This is the yaml for export from the pipeline.