MsBuild Compile and build dependencies in parallel

I am working on a large C ++ solution with a large number of projects.

Some of them are build bottlenecks where the dlls depend on the other that is required to build.

I have many processors to build, but I can not get MSBuild to compile (not link) everything in parallel and use dependencies only during reference.

Essentially, I want to have in every project:

# build objects
msbuild /t:BuildCompile project.vcxproj

# only now build/wait for dependencies
msbuild /t:ResolveReferences;BuildLink project.vcxproj

I want the above to work as part of a single assembly (cascading for dependent projects).

I am trying to get confused with MSBuild assembly orders:

<PropertyGroup>
  <BuildSteps>
    SetBuildDefaultEnvironmentVariables;
    SetUserMacroEnvironmentVariables;
    PrepareForBuild;
    InitializeBuildStatus;
    BuildGenerateSources;
    BuildCompile;

    ResolveReferences;

    BuildLink;
  </BuildSteps>
</PropertyGroup>

does not work, resolving dependencies in this setting does not create dependent projects.

Any ideas? Only the linker actually depends on the referenced projects, objs do not.

+4
1

: "" . , . msbuild , BuildCompile, Build. Build ( , ), , ResolveReferences Link , , , ..

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
  <ItemGroup>
    <AllTargets Include="BuildCompile;Build" />
  </ItemGroup>
  <Target Name="Build">
    <ReadLinesFromFile File="mysolution.sln">
      <Output TaskParameter="Lines" ItemName="Solution" />
    </ReadLinesFromFile>

    <ItemGroup>
     <AllProjects Include="$([System.Text.RegularExpressions.Regex]::Match('%(Solution.Identity)', ', &quot;(.*\.vcxproj)&quot;').Groups[ 1 ].Value)"/>
    </ItemGroup>

    <MSBuild BuildInParallel="true" Projects="@(AllProjects)"
             Properties="Configuration=$(Configuration);Platform=$(Platform)"
             Targets="%(AllTargets.Identity)"/>
  </Target>
</Project>

msbuild mybuild.proj /p:Configuration=Debug;Platform=Win32

, .

edit, , , , BuildCompile , BuildSteps. :

<MSBuild BuildInParallel="true" Projects="@(AllProjects)"
         Properties="Configuration=$(Configuration);Platform=$(Platform)"
         Targets="SetBuildDefaultEnvironmentVariables;
                  SetUserMacroEnvironmentVariables;
                  PrepareForBuild;
                  InitializeBuildStatus;
                  BuildGenerateSources;
                  BuildCompile;"/>

<MSBuild BuildInParallel="true" Projects="@(AllProjects)"
         Properties="Configuration=$(Configuration);Platform=$(Platform)"
         Targets="Build"/>
+1

All Articles