The past few weeks have been pretty busy for me. Not only was I working with some colleagues on a Robot challenge (where we finished third J, see here a movie with Woody in action  , and the post of my coleague Erik) , I also had to prepare for 3 sessions for the DevDays here in the Netherlands.

At my session on "Practical Team Foundation Server" for some reason my build server became unreachable. I promised I would post the demo and the sample task I was showing for stamping a build number in your assembly.

You can download the code for the FileVersion task over here: http://blogs.infosupport.com/files/folders/marcelv/entry12308.aspx
(Thanks to Paul Meyer from Microsoft who wrote this task used at a project we did together a while ago.)

Compile the task and copy the assembly into the folder: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies

What You further need to do is add to the team project build file a section with a target "AfterGet" this target will be called right after the sources are retrieved from the TFS server.  There you add for each project in the solution you build a task to update the AssemblyFileVersion with the current build number. In the task I used the pattern of dddyy where ddd is 1-365 and year currently 07.

Also you need to include the task in the project. See code snippet below:

<UsingTask TaskName="Devdays2007.build.FileVersion"

         AssemblyFile="$(TeamBuildRefPath)\Devdays2007.build.dll" />

<Target Name="AfterGet">

  <FileVersion FileName="$(SolutionRoot)\<your path goes here>\AssemblyInfo.cs" Increment="true" OverrideReason="Daily build">

    <Output TaskParameter="Version" PropertyName="DemoVersion" />

  </FileVersion>

</Target>

I will be posting the slide decks as soon as I get the green light from Microsoft. The most of the time want keep a survey before they provide you access to the slides. Since the feedback is also important for me, I will wait a few days until they got the time to send the evals. I will then post the original decks I used here on my blog or link to them depending on if they do the same trick as last year.