Team Build: matching assembly version number to build label

Let's assume that you override the target for creating a custom build label, so that the build label follows the same convention as an assembly version.

Now you create a new Team Build type that runs daily and uses your custom build label, and when it builds, the source code tree gets labeled with that build label (by default behaviour).

Now you want the compiled assemblies from that build to use as their version number the build label. (So you want to modify the AssemblyInfo.cs file, I suppose).

Is there an elegant way of doing this?

I can think of perhaps two ways you might do this:

In the build process, have a pre-compile task that looks for all AssemblyInfo.Cs (or .vb) files, and uses the <WriteLinesToFile> task to add the line to the file with the appropriate syntax. Or create a custom task in code to do the same thing but using Reflection.

It seems like a simple request, but one that has a complex answer. Am I missing something?

[975 byte] By [xhead] at [2007-12-17]
# 1
Hi

Yes, the ability to stamp assembly versions is a feature that we did consider and debated on - but finally ended up not providing out of the box.

The solution we had also was to write an MsBuild task and add it as a precompile task - pretty much like you explained. We are working on a sample task for this.
Meanwhile there are some Msbuild tasks on the web which might help you in this.
Try http://users.pandora.be/stombeur/code/Version.cs

Let me know if this does not help

Thanks
-Khushboo

khushbooSharan at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...
# 2
Hi,

I"m currently using the SDC UK Toolkit to do my build version labelling and am trying to do exactly what was mentioned in this post (matching the assembly version number to the build label). Is the sample task you're talking about available now ? Or will it be available in the final RTM release ?

thanks,
Leona

Leona at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...
# 3
Hi Leona

Unfortunately we do not have the sample ready by now as we are busy working on the V1 release. As you pointed out this will be available only in the RTM timeframe.

Thanks
-Khushboo

khushbooSharan at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - General...

Visual Studio Team System

Site Classified