Speedup Tfs builds with parallel compilation and incremental get

For large projects, the time needed to run a build can grow considerably large, until it eventually pass the famous barrier of 10 minutes. To speedup build time you can try to use some features of TFS,

Parallel Builds: Msbuild can run faster in multicore environment with the use of parallel builds, to enable this feature you can simply go to the machine where the tfs build agent is installed and you need to modify the file tfsbuildservice.exe.config located in *C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies,*and change the value for the MaxProcesses key property

1
2
3
4
5
    <!-- 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" />

Remember also that there are some properties of the build process that are related with parallel builds,  one is the BuildInParallelthat can be set to false to disable Parallel Builds, then you can set BuildConfigurationInParallelor BuildSolutionInParallelto fine tuning the parallelization of the process. Both of these properties are set to true by default. These settings can be used to solve specific problem.

Incremental builds. By default for each build the build agent download every file specified in the build workspace and regenerates all binary. For large project you can have better performance if you get only changed files and generate only the corresponding binaries. To achieve this you can set to true a couple of properties: IncrementalGet: instructs build machine to get only the files that are changed from last build, and IncrementalBuild: that instructs build machine to generate only binary for changed source file. To change these ones you can simply edit TFSBuild.proj

1
2
3
<PropertyGroup>
<IncrementalGet>true</IncrementalGet>
</PropertyGroup>

These two simple tricks can speed up build process for large projects, thus keeping your build time lower than 10 minutes.

alk.

Tags: Team foundation Server Continuous Integration