다음을 통해 공유


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"
             Projects="@(ConfigurationList)"
             Targets="CompileConfiguration"
             StopOnFirstFailure="$(StopOnFirstFailure)">
      <Output TaskParameter="TargetOutputs" ItemName="CompilationOutputs" />
    </MSBuild>

  • Modifying Microsoft.TeamFoundation.Build.targets to build each solution in parallel if possible, and
     <MSBuild BuildInParallel="true"
             Projects="@(SolutionList)"
             Targets="CompileSolution"
             StopOnFirstFailure="$(StopOnFirstFailure)">
      <Output TaskParameter="TargetOutputs" ItemName="CompilationOutputs" />
    </MSBuild>

  • 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

  • Anonymous
    June 20, 2007
    PingBack from http://www.universityupdate.com/technology/Microsoft_Visual_Studio/3324470.aspx
  • Anonymous
    June 21, 2007
    Brian Keller on New Team Test Case Studies: Hotmail.com and "March Madness". Roy Osherove on Get latest...
  • Anonymous
    July 20, 2007
    While some of the build agent properties are available in the VS GUI, buried in the tfsbuildservice.exe.config
  • Anonymous
    July 20, 2007
    While some of the build agent properties are available in the VS GUI, buried in the tfsbuildservice.exe
  • Anonymous
    June 26, 2008
    With Visual Studio Team Build 2008 there is no way to run two builds from within the same Team Project
  • Anonymous
    July 09, 2008
    TeamBuild can build one build definition from a single Team Project at a time. can run multiple build
  • Anonymous
    February 09, 2009
    There are a number of things you can do to improve build performance in TFS 2008: Reduce the scope of