Versioning your projects is hard, but setting up basic versioning functionality for your projects is not. This is what I learned from a very informative Video
from Immo Landwerth which I saw some days ago. So I sat down, took an old project of mine and tried it out. Turns out it's true.
GitVersioning enters the Arena
The project I used for that is an implementation of Fibonacci Heap I wrote when I was in school. It's a basic example of minimalistic library with no dependencies. You can find the code on Github.
Following the documentation on Github I just installed the command line tool via the dotnet-cli dotnet tool install -g nbgv
. After that you just have to use the install command nbgv install
in your project or solution root and it will add the files Directory.Build.props and version.json.
The former gets picked up from MSBuild and injects Git.Versioning in every project.
version.json is where you define the major and minor of your version number and additional tags like beta or preview you want to use.
At this point the versioning part of things is done. Afterwards I also configured the creation of the nuget package for my library. This will be the topic of a future article.