Cake 启用并行 MSBuild

Cake enabling Parallel MSBuild

在 cake 文件中,我如何 "enable parallel build" MsBuild 操作。我将消息输出到终端 "please add the "/m" switch",但我在传递给 MsBuild 方法的 MS Build Settings 中看不到如何执行此操作。

看看这段代码:

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

您可以使用 MaxCpuCount' 属性 来控制该标志。

例如:

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

    MSBuild("<path to solution file", msbuildSettings);