Search code examples
c#asp.nettfs-2015gitversion

GitVersion with Agent and Incrementing


I am looking for a way to use semantic versioning to have $(Major).$(Minor).$(Fix) on the file version of my project dll as well as on TFS2015. I succeeded to have it but now I face other troubles (see below)

I use the following lines in the .csproj which works very well to apply the buildnumber created by gitversion task:

<Version Condition=" '$(BUILD_BUILDNUMBER)' == '' ">1.0.1-local</Version>
<Version Condition=" '$(BUILD_BUILDNUMBER)' != '' ">$(BUILD_BUILDNUMBER)</Version>

The problem is that I am using an agent so it makes it a bit more difficult it seems that config is in .git\gitversion_cache*.yml.

I have read ton of documentation and currently I am able to use this .yml file but it looks like it is generated on the agent and then it is not replaced with default values 0.0.1+26.

So :
1) should I commit the yml config file or have it in a specific folder in the agent ? If on the agent how to tell tfs2015 where it is located ? The agent build directory is sometimes cleaned...
2) how you can auto-increment the $(Fix) variable?
3) how to have a command line to increase major and minor when there is a change? I could not find any information...

Regards,


Solution

  • Ok I found a solution that was to always add:

     +semver: fix
    

    to the commit message. I wish it could be setupped somewhere else but for now I will use this solution.