Team Build and Multiproc MSBuild

MSBuild is introducing a new feature in Orcas where projects can be built in parallel – see their team blog post for details.  Team Build has added support for this feature by:

  • Modifying Microsoft.TeamFoundation.Build.targets to build each configuration in parallel if possible,
    <MSBuild BuildInParallel="true"
      <Output TaskParameter="TargetOutputs" ItemName="CompilationOutputs" />

  • Modifying Microsoft.TeamFoundation.Build.targets to build each solution in parallel if possible, and
    <MSBuild BuildInParallel="true"
      <Output TaskParameter="TargetOutputs" ItemName="CompilationOutputs" />

  • Adding a MaxProcesses key to TfsBuildService.exe.config (typically installed to %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies) that allows you to specify, for a given build machine, how many processes should be used when msbuild.exe is invoked.
    <!-- MaxProcesses
         Set this value to the maximum number of processes MSBuild.exe should
         use for builds started by agents hosted by this executable.
    <add key="MaxProcesses" value="1" />

By default, the MaxProcesses key is set to one, meaning that only a single process will be used for builds and no parallelization (is that actually a word?) will occur.  To use more than one process, set the key to your desired value and restart the team build service (“net stop vstfbuild” and then “net start vstfbuild” for you command-line people).  At this point, the magic will kick in and (hopefully) your builds will speed up quite a bit. 

There are some caveats here – MSBuild can manage your intra-solution dependencies (assuming you have used project references) to make sure to only build things in parallel which can be built in parallel.  If you have build order dependencies that are not specified via project references (e.g. inter-solution dependencies and/or file references) you should stick to a single process. 

Comments (7)

  1. Brian Keller on New Team Test Case Studies: and "March Madness". Roy Osherove on Get latest…

  2. Buck Hodges says:

    While some of the build agent properties are available in the VS GUI, buried in the tfsbuildservice.exe.config

  3. While some of the build agent properties are available in the VS GUI, buried in the tfsbuildservice.exe

  4. With Visual Studio Team Build 2008 there is no way to run two builds from within the same Team Project

  5. TeamBuild can build one build definition from a single Team Project at a time. can run multiple build

  6. Jim Lamb says:

    There are a number of things you can do to improve build performance in TFS 2008: Reduce the scope of