4

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.

Colin Mackay
  • 18,736
  • 7
  • 61
  • 88

1 Answers1

7

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);
Gary Ewan Park
  • 17,610
  • 5
  • 42
  • 60