Our division’s primary Team Foundation Server is running TFS 2008 and as such we’re using Team Build 2008. This week I wanted to set up a Team Build 2008 definition to build a .NET 4.0 Silverlight application and this post explains how to do that.

  1. Your build agent must be running Team Build 2008 Service Pack 1. If you do not have Service Pack 1 installed you will receive an error relating to a missing parameter on the GetBuildProperties task once you install Visual Studio 2010 Beta 2 on the build agent. Thanks to Aaron Hallberg for helping me resolve this issue.
  2. Install Visual Studio 2010 Beta 2 on the build agent to make sure that .NET Framework 4.0, the .NET Framework 4.0 SDK, and other dependencies are available.
  3. Configure Team Build 2008 to use MSBuild 4.0 instead of MSBuild 3.5. To do this edit %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\TFSBuildService.exe.config and set the MSBuildPath property to C:\Windows\Microsoft.NET\Framework\v4.0.21006\.
  4. Restart the Team Foundation Build service.

Please note that this is a build agent-wide setting and ALL build definitions built by that build agent will use MSBuild 4.0. This typically isn’t an issue because MSBuild has good backwards compatibility but you should be aware of this.

That’s all there is to it… So far I’ve only built a single .NET 4.0 Silverlight application but this technique should work for all .NET 4.0 applications.

[Edit] Added step 4 to restart the service.

[Edit] Added missing "v" in framework path.