Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cake enabling Parallel MSBuild

Tags:

cakebuild

In a cake file, how do I "enable parallel build" on MsBuild actions. I get the message output to the terminal to "please add the "/m" switch", but I don't see how to do this in the MS Build Settings that I pass into the MsBuild method.

like image 811
Colin Mackay Avatar asked Mar 07 '23 21:03

Colin Mackay


1 Answers

Have a look at this section of code:

https://github.com/cake-build/cake/blob/37642a71049a2708af13886e34364fe68959f2d7/src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs#L58

You can use the MaxCpuCount' property to control that flag.

For example:

    var msbuildSettings = new MSBuildSettings()
            .WithProperty("TreatWarningsAsErrors","true")
            .WithTarget("Build")
            .SetMaxCpuCount(0)
            .SetConfiguration("release")
            );

    MSBuild("<path to solution file", msbuildSettings);
like image 95
Gary Ewan Park Avatar answered May 05 '23 04:05

Gary Ewan Park