question

MohammadMohsin-9010 avatar image
0 Votes"
MohammadMohsin-9010 asked TianyuSun-MSFT commented

Delphi Projects are not getting built in parallel with MSBUILD

I am trying to build Delphi independent projects in parallel by using the BuildInParallel parameter with /m switch but the projects are getting built sequentially.

While calling Delphi projects from proj file I was getting the error MSB4057: The target "Build" does not exist in the project and that gets resolved by using a batch file that will combine the lines of rsvars.bat and msbuild.exe.

The content of proj and batch file looks like this;


PROJ file content

 <Target Name="TargetTest"> 
    
         <ItemGroup> 
    
             <TargetProjectsToBuild Include="$(ProjectDir)\Server\Common\lib.dproj"/> 
    
             <TargetProjectsToBuild Include="$(ProjectDir)\Server\XXXX server\Test1.dproj"/> 
    
             <TargetProjectsToBuild Include="$(ProjectDir)\Server\XXXX server\Test2.dproj"/> 
    
             <TargetProjectsToBuild Include="$(ProjectDir)\Server\XXXX server\Test3.dproj"/> 
    
             <TargetProjectsToBuild Include="$(ProjectDir)\Server\XXXX server\Test4.dproj"/> 
    
             <TargetProjectsToBuild Include="$(ProjectDir)\Server\XXXX server\Test5.dproj"/> 
    
         </ItemGroup> 
    
         <Exec Command="&quot;$(BatFilePath)\BuildDelphi.bat&quot; &quot;%(TargetProjectsToBuild.Identity)&quot; Release Win64 $(OutDir) Build $(SigningDelphiCert)" ContinueOnError="true"/> 
    
 </Target>

Batch file content

 call "C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\rsvars.bat" 
    
 MSBuild.exe %1 /p:BuildInParallel=true;Config=%2;Platform=%3;Outputfolder=%4;Certificate=%6 /t:%5 /m:2

There are 2 cores available on the agent




vs-msbuild
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MohammadMohsin-9010 , welcome to Microsoft Q&A forum. Did you try to set the BuildInParallel property in PROJ file? And set -maxcpucount switch to a value great than 1? Please refer to this doc: BuildInParallel task parameter.

0 Votes 0 ·

Hi @TianyuSun-MSFT, I tried using BuildInParallel in the PROJ file instead of executing it from a separate batch file and also called rsvars file before the MSBuild task but in that case, I am getting an error Build Target not found.


 <MSBuild Projects="@(TargetProjectsToBuild)" BuildInParallel="true" Targets="Build" Properties="Configuration=Release;Platform=Win64;OutputPath=$(OutDir);OutDir=$(OutDir)" ContinueOnError="true"/>
0 Votes 0 ·
TianyuSun-MSFT avatar image TianyuSun-MSFT MohammadMohsin-9010 ·

Hi @MohammadMohsin-9010 , so does the output log in CMD/Developer Command Prompt/command line tool show something like 1>, 2>x> and on node 1, on node 2on node x?

203975-image.png

0 Votes 0 ·
image.png (73.8 KiB)
image.png (73.9 KiB)
Show more comments

0 Answers