Liero
Liero

Reputation: 27390

Assembly versioning using in TFS with Git

I'm looking for a solution for assembly versioning as part of Continuous Integration using TFS2015 and Git as a source control.

The tricky part is that I want to increment assembly version only when the project has changed since last build.

Previously I was using TFVC, which provides API for last changeset number for a specified directory and I created powershell, that updates the assemblyversion with current changeset number only when the sources in particular project has changed since last release. I also needed to store the changeset number somewhere on the build server so I know what versions has been released.

  1. Is there an existing solution?
  2. If no, do you have recommendations?
    • Should I create nuget package, that modifies csproj with custom task or powershell script or even custom build step?
    • How should I increment the assembly version? Should I use buildnumber as a revision number? In such case, how would I re-release older versions?

Upvotes: 1

Views: 476

Answers (1)

Gary Ewan Park
Gary Ewan Park

Reputation: 19021

Have you looked at GitVersion:

https://github.com/GitTools/GitVersion

It does the work of calculating a Semantic Version number for the current state of your application, based on the history of your git repository. It knows when to increment the various portions of the build number, and you can then use the asserted version number to then package your application in nuget packages, etc.

Full disclosure: I am a maintainer on this project;.

Upvotes: 1

Related Questions