October 2008 Entries
Visual Studio 2010 info and the new TeamPrise Remote Accelerator

Eugene has all the lowdown for getting and using the brand new VSTS2010 VPC.  Check out the info here

Also my good friend Martin at TeamPrise just announced a brand new product called the Remote Accelerator.  I’ve beta tested it and it’s really cool.  All the info here

Wish I was at PDC…

Lots of good stuff on Windows Azure also.  You can find a lot here

Cheers,

ET

Matching TFS build labels with custom build number

So I’ve been trying to do some custom build numbering for my Team Build project and was confronted with a lot of let’s say “uninformation” and some great information also.  I really didn’t want to create a custom task that I would need to maintain so I set on a long search for the Truth… needless to say I didn’t find it.  But here is the information I found that should get you you to the right place.

There is a great custom task created by the MSBuild team that used to be on GotDotNet but is now MSDN Code Gallery.  It’s called the AssemblyInfo Task there is currently a bug with that custom task that breaks is starting in 2007 and it has to do with the fact the build parts a.b.c.d can’t be bigger than 65k.  You can find a great explaination here and here of the problem and solution. Once I worked that out I proceeded to Team Build.

 

There is a great reference post by Gautam Goenka (MSFT) about how to implement this custom task in Team Build I did exactly with he suggests in Using AssemblyInfo task with Team Build.

Now I was pondering, “Will this work and set the same number for ALL solution I’m building in my TFSBuild.proj file? Now that would be neat”.  I first started with one solution and all worked great.  I then put two solution and bam! exactly what I wanted, same number everywhere for each csproj or vbproj project compiled in all the solutions.

Note: If you have a mix of VB.NET and C# you might need to add stuff in the AfterGet to make sure you check-out all the AssemblyInfo.vb and AssemblyInfo.cs but that shouldn’t be too hard to do.

So all was good… well almost, Team Build creates is own build numbering something like BuildDefinition_yearmonthday.buildrun which is very nice but doesn’t match my shiny new a.b.c.d so what should I do to make them match, off to Internet again to find information about how to override the build name in Team Build.  There is just such an override that we need to use it’s call BuildNumberOverrideTarget problem is I’m stuck in a catch 22 the task occurs before the build number gets created by the AssemblyInfo task so essentially I couldn’t use this.  Off to the Internet again… Lots of people complain and try to solve this by changing the order of the overrides, calling some AssemblyInfo task twice once before to get a number and once after…yuck in the end it was not very nice.  I needed a way to change the build number in Team Build but after the compile worked.  So in the target AfterCompile that is used in Gautam’s post I added two things

  <Target Name="AfterCompile" Condition="'$(IsDesktopBuild)'!='true'">
    <Exec WorkingDirectory="$(SolutionRoot)"
          Command="$(TF) checkin /comment:&quot;Auto-Build: Version Update&quot; /noprompt /override:&quot;Auto-Build: Version Update&quot; /recursive $(AssemblyInfoSpec)"/>
    <RemoveDir Directories ="$(DropLocation)\$(BuildNumber)"/>
    <CreateProperty Value ="$(BuildDefinitionName)_$(MaxAssemblyVersion)">
      <Output TaskParameter ="Value" PropertyName ="BuildNumber"/>
    </CreateProperty>
    <UpdateBuildNumberDropLocation
              TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
              BuildUri="$(BuildUri)"
              BuildNumber="$(BuildNumber)"
              DropLocation="$(DropLocation)\$(BuildNumber)" />
  </Target>

First thing we need to do is remove the original build drop location using the RemoveDir task.

Next, the CreateProperty create a new BuildNumber based on the number that was used in the AssemblyInfo Task so that’s exactly what we need now instead of BuildDefinition_yearmonthday.buildrun we have BuildDefinition_a.b.c.d.

Finally, the kicker I was searching in the Microsoft.TeamFoundation.Build.targets file in C:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild directory and in there I found what I needed amongst all sort of very cool information about the tasks that are called by TeamBuild but my nugget was in the InitializeEndToEndIteration Target, which is called after the BuildNumberOverrideTarget. I noticed this nifty task called UpdateBuildNumberDropLocation with this comment on top

    <!-- Update the build number and drop location in the database. This task will also create the drop directory 
         and grant the service account full rights on it.

Ah ah! I said to myself, this is exactly what I need.  An what do you know, I updated my AfterCompile Target like above and the sweetness of victories came to me.  Now the build number in the build report match and all the assembly compiled by my build definition have the same number.  While the build is running at the beginning you will have the wrong number for a while (the old one) but at the end you should be good to go.  The nice thing about that is it’s calling the same task the Team Build is calling so all the reports and links etc all work with the new number.

I hope this helps you guys I know I spend a lot of time trying to figure an elegant way to do this.

ET

 

Update: William Bartholomew one of my new fellow MVP sent me an email with this advice, add $(NoCICheckInComment) to the TF command (the first Exec) so that this particular check-in (of assemblyinfo change) won’t trigger and infinite loop of builds if you have a CI build on your build server.  Also he add another suggestion on how to resolve the problem but it involves creating you own build task to update the number (which I didn’t want to do)

here what he suggests

  1. Call the Version task from MSBuild Community Tasks (http://msbuildtasks.tigris.org) in BuildNumberOverrideTarget to allocate a new version number.
  2. In the AfterGet (or BeforeCompile) extensibility tasks update the AssemblyInfo files using the $(BuildNumber). I actually wrote my own custom task to modify the AssemblyInfo files but if the AssemblyInfo Task allows you to pass in the version number you could use that too.

Finally I notice my other good friend Martin also has a nice blog post of this Aligning Build Numbers with Assembly Versions in TFS2008

 

Visual Studio Team Development Edition and Visual Studio Team Database Edition now one product…

In case you didn’t know, as part of the slew of information that Microsoft in this week one very cool announcement was made.  VSTDE and VSTDBE are now both available to MSDN subscriber that have one of those versions. 

If you do, make sure you download the one you didn’t have (DBPro if you had Dev and Dev if you had DBPro) and install the other on top of the current VS you have.  They functionality of the other version will just become available in VS.  It’s as simple as that.

Kudos to Microsoft for making this happen I think this is a great decision and will bring great value to the current owner of those respective versions.

http://blogs.msdn.com/gertd/archive/2008/09/29/team-developer-team-data-team-developer.aspx

 

Cheers,

ET

Upcoming TFS power tools… This is MAJOR!!

Have a look at Brian Harry’s blog entry on the next generation power tools probably available end of October…

A new team menu with presence, and team based tasks…

A new way to download project related custom add-ins like check-in policy and Custom work item control.  This is something I commented about way back in 2005 as a big hole to fix.  I’m glad they tackled this. This is going to be very sweet in a corporate environment.

Shell integration looks great but I’m not really a fan of that.  I would rather live in VS so a lot of those functions I already have integrated.  But I know a lot of folks that have been waiting for this.  This will compete nicely with the subversion equivalent.

PowerShell support is also cool.  All the command line utilities in PS… sweet!!

 

I’m really exited about this next release and I’m looking forward to using them.

Here are a few pics to wet your appetite… go to Brian’s blog for a lot more.

 

Cheers,

ET

Technorati Tags: ,
4th MVP Award

I feel rely privileged again this year to be awarded for my 4th time as a Team System MVP.  This award as great value to me since it recognizes my expertise in a product and my dedication to the community.  I spend a lot of time with developers both inside and outside EDS and I can tell you they are always exited to learn about new things they can do with the product. 

This year is going to be an extremely exiting year with VSTS2010 aka “Rosario” and the .Net Framework 4.0 work going in overdrive.  I’m really looking forward to doing to talks on this and working on the VSTS council this year.

I’m extremely grateful for all the opportunities I’ve been presented with in the last 4 years and I know a lot of them come from the MVP status.  Like Imagine Cup, MVP summit, UG leadership, etc.

Well that’s it for now.

Cheers,

ET

Technorati Tags: ,