views:

636

answers:

3

I am building a release of my project using tfs build which generates a unique identity for the build in tfs build explorer such as "MyProject_20090122.1" indicating that this is the first build on 2009-01-22. However this is my release 1.0.0 of MyProject. Is there a way to connect the two identifiers or do I have to maintain the mapping externally and elsewhere?

Should I make my version identifier confirm to the way the tfs build names so that my version number for the above should be 1.0.20090122.1?

Is there a way to add comments to a tfsbuild?

How do you do it?

Edit:

As some have suggested the version number can be updated via msbuild and automatically incremented. The question however is how do I determine which version a specific team build is as the version number is not embedded in the build name? Can I control the identifiers for the tfs build name?

+1  A: 

You can override the versioning target to supply your own version number. That way you can conform to x.x.x or whatever style you want. Ideally, x.y.x would mean x is major version, y is minor (point release) and z is a unique build number that increments each build. You might also want to check in again the assemblyinfo.cs with the new updated build number (1.0.1423 for example).

There is a lot of info about this via google. In particular: http://geekswithblogs.net/etiennetremblay/archive/2008/10/03/matching-tfs-build-labels-with-custom-build-number.aspx

DarkwingDuck
A: 

Hi JoJoe

I've taken my msbuild file and overridden the version number generation step. This allows me to push in my own version number which MSBuild then uses throughout the build steps.

The file you need to edit is the TFSBuild.proj file which is essentially just an MSBuild file.

If you have a target named "BuildNumberOverrideTarget" like the code below, you can tell MSBuild to use your custom number. There is also an MSDN article on how to override the build number.

<Target Name = "BuildNumberOverrideTarget" >
    <BuildNumberGenerator> 
    <Output TaskParameter="BuildNumber" PropertyName="BuildNumber"/> 
    </BuildNumberGenerator> 
  </Target>

Essentially all you have to do is write a target that overrides BuildNumberOverrideTarget and your build will reflect this.

Ray Booysen
A: 

Check out my blog post for full details on how to create and integrate your own TFS build number generator: http://www.grahamzero.com/blog/2009/03/team-foundation-server-2008-build-number-generator.html