MSBuild Parameters
Now that MSBuild is successfully compiled my project, the following questions came up in my mind:- Does Delphi call DCC or MSBuild?
- What parameters can I pass in?
Based on the highlighted output in the previous screenshot, I came to three conclusions:
- Delphi built the .dproj file, so the IDE must launch MSBuild to compile the project.
- Delphi built the project in Debug mode, so there must be an MSBuild parameter to specify the build configuration.
- Delphi built the project for the Win32 platform, so there must be an MSBuild parameter to specify the platform.
<PropertyGroup Condition="('$(Platform)'=='Win64'...This looked promising! Based on these three XML snippets, I came to three more conclusions:
...
<PropertyGroup Condition="'$(Config)'=='Release'...
...
<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
- The MSBuild parameter for specifying the build configuration is called Config.
- The MSBuild parameter for specifying the build platform is called Platform.
- Embarcadero ships a default target file, located under $(BDS)\Bin\CodeGear.Delphi.Targets.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe ZLibEx_XE2.dproj /p:Config=Debug /p:Platform=Win32It compiled successfully. Then, I replaced Win32 with Win64. Sure enough, it failed due to the ZLibEx obj files being 32-bit. I had only one question left:
- How could I override where to put the DCU files?
<DCC_ObjOutput Condition = " '$(DCC_ObjOutput)' == ''">$(DCC_DcuOutput)</DCC_ObjOutput>That was the answer I needed. The parameter I was looking for was DCC_DcuOutput. So, for my final test, I ran:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe ZLibEx_XE2.dproj /p:Config=Debug /p:Platform=Win32 /p:DCC_DcuOutput=C:\Temp\DCUSure enough, my DCU files ended up under C:\Temp\DCU. Perfect! By that point, I was ready to start my PowerShell module.