在VSTS中实现并行构建的信心

时间:2017-10-04 10:53:07

标签: azure-pipelines parallel-builds

我正在考虑启用:

Build in parallel

我想知道如何在本地Visual Studio中进行构建,理论上如果它在本地并行构建就好了,我应该在VSTS中足够安全。

在ye'olden的日子里,使用msbuild命令行voodoo可以实现并行构建,根据我对复杂项目的经验,它似乎很少使用其他CPU内核。

但是在Visual Studio 2017中,它很简单,我现在有一个很好的绿地项目(欢乐时光):

maximum number of builds

我可以从Visual Studio的构建输出告诉我实际最终并行构建了多少个项目,让我对VSTS设置充满信心吗?

1 个答案:

答案 0 :(得分:1)

当然,请参考以下步骤更改MSBuild输出详细程度(在屏幕截图的同一窗口中):

  1. 工具=>选项
  2. 选择项目和解决方案=>构建并运行
  3. 在MSBuild项目构建输出详细程度中选择“正常”
  4. 然后VS输出窗口中的构建日志将如下所示:

    1>------ Rebuild All started: Project: MVCCore20, Configuration: Debug Any CPU ------
    2>------ Rebuild All started: Project: ConsoleApp1, Configuration: Debug Any CPU ------
    3>------ Rebuild All started: Project: ConsoleApp2, Configuration: Debug Any CPU ------
    4>------ Rebuild All started: Project: ConsoleApp3, Configuration: Debug Any CPU ------
    2>Target CoreClean:
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\bin\Debug\netcoreapp2.0\ConsoleApp1.deps.json".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\bin\Debug\netcoreapp2.0\ConsoleApp1.runtimeconfig.json".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\bin\Debug\netcoreapp2.0\ConsoleApp1.runtimeconfig.dev.json".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\bin\Debug\netcoreapp2.0\ConsoleApp1.dll".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\bin\Debug\netcoreapp2.0\ConsoleApp1.pdb".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\obj\Debug\netcoreapp2.0\ConsoleApp1.csprojResolveAssemblyReference.cache".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\obj\Debug\netcoreapp2.0\ConsoleApp1.csproj.CoreCompileInputs.cache".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\obj\Debug\netcoreapp2.0\ConsoleApp1.AssemblyInfoInputs.cache".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\obj\Debug\netcoreapp2.0\ConsoleApp1.AssemblyInfo.cs".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\obj\Debug\netcoreapp2.0\ConsoleApp1.dll".
    2>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp1\obj\Debug\netcoreapp2.0\ConsoleApp1.pdb".
    2>Target GenerateTargetFrameworkMonikerAttribute:
    2>  Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
    4>Target CoreClean:
    4>  Deleting file "D:\1.0_Starain\1.0_Work\4.8_VSO\1.1_Projects\2017\MVCCore20\ConsoleApp3\bin\Debug\netcoreapp2.0\ConsoleApp3.deps.json".
    2>Target CoreCompile:
    

    数字1,2,3,4表示流程。

    另一方面,如果在VSTS构建任务中选中并行构建选项,它会向MSBuild命令添加/m参数,因此数字处理是每个处理器的数量在计算机上,如果要使用自定义值,则需要取消选中该选项并在 MSBuild Arguments 输入框中指定/m:X参数。