Pete C. Pete C. - 1 year ago 119
Git Question

TFS 2015 Version Numbering By Branch

I am creating a Continuous Integration build definition against against a Git repository in TFS 2015. The definition is configured with triggers against both the "master" and "develop" branches.

Based on the branch that triggers a build, version numbers need to be incremented as follows:

develop branch:


ie; Maintains current major & minor versions, increments the build number only

master branch:


ie; Maintains the major version, increments minor version and resets the build number for subsequent builds on the develop branch

On completion of a successful build, the respective branches need to have a tag (label) applied to indicate the version that was built.

Answer Source

This kind of complex version number setting can't achieved in a single TFS build definition for now.

TFS can't increase the build number based on which branch trigger the build. It's using $(Rev:.rr) to ensure that every completed build has a unique name. When a build is completed, if nothing else in the build number has changed, the Rev integer value is incremented by one. More details, please refer this two threads Specify general build definition settings & vNext Build Awesomeness – Managing Version Numbers

For your situation, you may have to create two build definition correspond develop and master branch. Then manually increase the minor value in develop build definition.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download