Search code examples
gitsemantic-versioningassemblyinfonuspecgitversion

Git tag from AssemblyInfo version


TLDR; After installing and configuring gitversion, how do I "hook up" my git repo and .nuspec to use the generated version number by the injected AssemblyInfo ?

It's my first time trying to properly version anything automatically. So far I've always done this in git, by hand. It's when i started using MyGet, to push my first NuGet package to NuGet.org that I saw MyGet adding version tags to my git repo but. But what MyGet precisely does doesn't suit my desires.

I would like my Git (note: I heavily rely on GitKraken) to automatically ad versioning tag/number in the commit every time I merge a feature/release/hotfix in GitFlow (or any other system if it is necessary for a such system to work).

I use the NuGet version of gitversion to automatically update my AssemlyInfo.cs and it seems to work properly but I would like to use the generated number in my git tags automatically (and in my MyGet/NuGet packages if possible too)

note: I feel like this question is VERY poorly worded, but i have re-written it multiple times already and i simply feel like there is something here that i don't understand, which makes all of this very confused in my mind...


Solution

  • GitVersion is a tool that asserts the semantic version number of your application, based on the history of your git repository. While there is some functionality for updating certain files with the asserted version number, it doesn't do everything. Simply put, it isn't meant to. As a tool, it asserts the version numbers, making them available for other parts of the build pipeline.

    In order to do the additional steps that you are asking for, you are going to need to do that as part of your build. i.e. some additional steps within your Continuous Integration Server, or by using a build orchestration system like psake, or FAKE, or Cake, or something else.

    It is unlikely that GitVersion will do everything that you want.