Adding back the MSBuild MultiProc option in TfvcTemplate.12.xaml

I have recently been updating our build infrastructure to TFS2013 and noticed the option to run MSBuild in multi proc (or not) is no longer available in the new TFS process templates TfvcTemplate.12.xaml. This has caused some issues that only manifest in multi proc mode. (my particular issue was with using sandcastle)

Luckily its an easy few steps to add this option back…

StepĀ 1 – I find it useful when working with templates to place them within a class library to get all the relevant assembly references. Create a new project and add to source control.

StepĀ 2 – Download the template. TFS2013 now stores the default template in a global location, i.e. so you don’t have multiple copies of this template in each Team Project. However you need edit this and check it back into TFS. Create a new Build Definition, Process Tab, Show Details and you get the option to download the template.

1

Step 3 – Add a reference to Microsoft.TeamFoundation.Build.Common

Step 4 – Edit the Workflow Argument “AdvancedBuildSettings”. Add a new value for MSBuildMultiProc default of True, complete object constructor is…

New Microsoft.TeamFoundation.Build.Common.BuildParameter(” { “”MSBuildArguments”": “”"”, “”MSBuildPlatform”": “”Auto”", “”PreActionScriptPath”": “”"”, “”PreActionScriptArguments”": “”"”, “”PostActionScriptPath”": “”"”, “”PostActionScriptArguments”": “”"”, “”RunCodeAnalysis”": “”AsConfigured”", “”MSBuildMultiProc”": “”True”" } “)

Step 5 – Edit the Metadata argument. Click on ellipse button to bring up the editor, add a new value with the following settings…

2

Step 6 – On the workflow find the “Run MSBuild” activity and bring up the properties window. Set the MSBuildMultiProc value to…

Boolean.Parse(AdvancedBuildSettings.GetValue(Of String)(“MSBuildMultiProc”, “True”))

3

Step 7 – Check into Source Control

Step 8 – Create a new build definition using the new template.

4

Bingo – we now have the option to turn is back on and off again.