0

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,

4

2 回答 2

1

You could add task Update Assembly Info in your TFS build definition, to update assembly info of one or multiple files or projects during build.

Or add powershell task to set assembly versions. Check the blog below:

https://writeabout.net/2015/11/01/set-assembly-and-app-version-to-a-matching-build-name-in-tfs-2015-or-vso-build-vnext/

于 2018-06-01T10:02:45.463 回答
0

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.

于 2018-06-04T16:24:44.220 回答