Getting revision number from teambuild build number

Hi all,
It seems that TeamBuild defines the buildnumber for a given build in a manner similar to "20060531.13". We would like to use this information when updating the AssemblyInfo.cs files. Namely, to use the 20060531 part and the "13" part in the AssemblyVersion build and revision fields.

We are already using the AssemblyInfo task, but we see that it maintains it's own incremental numbers, which are not related to the TeamBuild incrementals, which means that are Assembly versions will not tie in with the lables applied in TeamBuild

Is there any properties other than BuildNumber that would give us separately the 20060531 and 13 parts so that we can pass them into the AssemblyInfoTask

Sincerely
Pete


Answer this question

Getting revision number from teambuild build number

  • Jan M

    There are no such properties available within the MSBuild script. Probably the easiest thing here would be to write your own custom task to parse the build number and output these properties. The XML would look something like this:

    <UsingTask TaskName="MyNamespace.ParseBuildNumber" AssemblyFile="MyNamespace.ParseBuildNumber.dll" />

    <ParseBuildNumber BuildNumber="$(BuildNumber)">

    <Output TaskParameter="NewBuildNumber" PropertyName="NewBuildNumber" />

    <Output TaskParameter="Revision" PropertyName="Revision" />

    </ParseBuildNumber>

    Your task would then, in it's Execute method, parse it's BuildNumber property and place the appropriate values into the NewBuildNumber and Revision properties. Of course, you would need to make sure this task gets executed prior to the AssemblyInfo task, etc.

    -Aaron



  • Kajalsoni

    I have couple of simple questions -

    1. How do I pass in the values (NewBuildNumber and Revision) to the AssemblyInfo task

    2. How do I specify in the tfsbuild project file the order in which the AssemblyInfo task and my custom task execute

    Thanks,

    Mahendra.


  • Shadowflip

    did anyone build such msbuild tasks i would need them aswell

    regards, Tilli



  • DSONG

    1. Use something like this in your custom task: CurrentBuild="$(BuildNumber)". From the CurrentBuild parameter parse, the revision value as Aaron mentioned.
    2. I'm not sure if you can send the revision number alone to the AssemblyInfo task; it's been awhile since I looked at it. But another solution, which is not too complicated either, is to rewrite the AssemblyInfo task to use the revision number in the format you want.


  • Getting revision number from teambuild build number