InteXX
InteXX

Reputation: 6367

How to version assemblies—pre-build—based on work items

I'd like to automatically increment my assembly versions based on this ruleset:

  1. Revision is always 0
  2. Build is incremented when the only WIT in the release is a Bug fix
  3. Minor is incremented when the release contains any WIT other than a Bug fix; Build is then always set to 0
  4. Major is never automatically incremented

Naturally this will require a build step that can interact in some way with the project.

My first thought was to build a small Windows Service that utilizes the TFS SDK to construct the version number based on these rules and return it via a WCF call, etc. But I run into a problem there with a business requirement that all code and functionality must be replicated into a VSTS project as well (the customer owns the code and must be able to proceed without me). There's no installing such a service there, of course.

I then considered installing the service on his server, in turn making it available to VSTS. This would pass the Rube Goldberg test with flying colors.

Is there an easier way of accomplishing this task? One that can work in both environments?

EDIT

I found this, but it's doubtful that the TFS SDK is registered in the GAC for VSTS.

Can someone confirm? Is the TFS SDK available to build scripts running on VSTS?

Upvotes: 3

Views: 211

Answers (1)

InteXX
InteXX

Reputation: 6367

Well now that didn't take long.

I found this and this for using PowerShell to query the REST API. No GAC/SDK needed.

-- EDIT -----------------

I've intentionally excluded content from the pages behind these links as the solutions provided are exceedingly complex; it's not possible to cover the concepts here in a single post. In case the pages disappear or the URLs change, here are the links at archive.org:

1. PowerShell and vNext Builds
2. VSTS/TFS REST API: The basics and working with builds and releases

In any case, the concept is popular and well-covered—in the event these two become inaccessible, there are many others available on the same subject matter. As quickly as I found these, someone could find more.

Upvotes: 1

Related Questions