Cake启用并行MSBuild

Col*_*kay 4 cakebuild

在一个蛋糕文件中,如何在MsBuild操作上"启用并行构建".我得到消息输出到终端"请添加"/ m"开关",但我没有看到如何在我传递给MsBuild方法的MS Build Settings中这样做.

Gar*_*ark 7

看看这部分代码:

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);
Run Code Online (Sandbox Code Playgroud)