Parallel Targets with Exec Command saturate the machine with lots of MSBuild.exe

Apr 28, 2014 at 11:03 AM

I have to build ~200 CustomBuilds (MOC Qt and UIC).
I use an Exec Task in targets with the MOC command line.

It works, but the build creates lots of MSBuild.exe for each targets and waits for the creation of all that processes before compile. ~35 Mo for each MSBuild.exe, it saturates RAM.

Is there any option to limitate and reUse MSBuild.exe (I tried /nr option, but it doesn't work) ?

Here is an example of my VCXProj file

The CustomBuild:
<CustomBuild Include="File.h">
      <AdditionalInputs Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|Win32&apos;">File.h;C:\SourceCode\Qt\4.7.1_2010\bin\moc.exe;%(AdditionalInputs)</AdditionalInputs>
      <Command Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|Win32&apos;">C:\SourceCode\Qt\4.7.1_2010\bin\moc.exe -withAllParameters</Command>
      <Message Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|Win32&apos;">MOC File.h</Message>
      <Outputs Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|Win32&apos;">moc\moc_File.cpp;%(Outputs)</Outputs>
A Target of a CustomBuild:
<Target Name="Target_MOC_File">
    <MSBuild.ExtensionPack.Framework.SmartExec Condition="%(CustomBuild.Identifier)=='MOC_File'" Command="%(CustomBuild.Command)" />
And the configuration with the call of all my MOC Targets:
<Target Name="MOCTargets">
    <MSBuild.ExtensionPack.Framework.Parallel NodeReuse="True" MultiProc="True" MaxCpuCount="4" TaskAction="BuildTargetsInParallel" Targets="Target_MOC_File, ..." />
I hope that you will have an answer ! =)

Have a very nice day!
May 19, 2014 at 3:10 PM
I solved my problem with using sets of targets.
MSBuild.Extension.Pack.Parallel wait for all MSBuild's loading before beginning target.

I cut 200 in 8 sets of 25 targets.
And it doesn't saturate RAM.

Good bye !
Marked as answer by CloudCompany on 5/19/2014 at 7:10 AM