Friday, June 13, 2008

Auto Increment Build Numbers when using TFS & TeamBuild

Nikhil Singhal's Blog - How to AutoIncrement version with each build using Team Foundation Server build (with a little help from AssemblyInfoTask)

“One common requirement with any decent sized multi-version product is to automatically update the version numbers of the binaries on a regular basis. This is generally achieved by updating the AssemblyInfo.cs (or other language equivalent ) files.

There are a couple of ways to do this:

1. Assign one developer to remember to increment the numbers on a daily basis. Yes, don’t get mad at me. I know this sucks. I just listed it here as an option.

2. Use the nightly build (or equivalent tool) to do this automatically.

3. If you use Team Foundation Server to manage your daily (or nightly builds), you can use one custom task developed by the nice people at Microsoft. The task is aptly named AssemblyInfoTask. This task used to be hosted at http://www.gotdotnet.com/ but since it closed people often to go http://www.codeplex.com/ to search for it. Well, it now resides at code.msdn.com. The direct link to the project is http://code.msdn.microsoft.com/AssemblyInfoTaskvers.

Once you download it and follow the instructions and set it up, you will run into the next problem. …

Ok. Now you have got this build to happen on your dev box. How do you set this up on your build server?

Simple. …

Now we have covered this properly. Let’s check this file in and fire a build. If you have enabled check-in mails, you should get a mail that will tell about AssemblyInfo files getting updated.”

This is a nice walk through to add auto-incrementing build numbers as part of your TeamBuild process. This is something that will come in handy next week when we start our first CI project…

Related Past Post XRef:
MSBuild Community Tasks Project
Auto Increment Visual Studio 2005 Version Build and Revision via MSBuild Task




1 comment:

Anonymous said...

Wow I love the oppurtunity that we have now a days to pick and choose where we want to go from visually seeing everything on the web! I mean I am quite new to the whole blogging game, but its really fun and interesting! I mean look at what we run into?!?
Blogs like these that I just have to comment on! :)