Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi MSBuild Build Configurations From Command Line

Delphi 2009 uses build configurations. When you create a new project you have two default build configurations "Debug" and "Release".

Now I asked myself how to automate builds using MSBuild (which is supported by Delphi since version 2007).

You can start the "msbuild" command in the "RAD Studio Command Prompt" in some Delphi project directory and it will build the default build configuration (the last activated build configuration inside the Delphi IDE).

Now, I want to specify a certain (non-default) build configuration by a command line parameter.

The Delphi help asserts that the parameter is [/p:configuration=<configuration name>], which is wrong (Delphi 2009, Help Update 1)!

What is the right way?

like image 526
ulrichb Avatar asked Feb 17 '09 18:02

ulrichb


People also ask

How use MSBuild command line?

To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.

How do you clean MSBuild solution?

Cleaning up specific projects: msbuild MyProjectFile1 /t:Clean msbuild MyProjectFile2 /t:Clean ... This has to be repeated for all projects you need to clean, because MSBuild only accepts single project on command line.

How do I find MSBuild path?

For example, the path to MSBuild.exe installed with Visual Studio 2019 Community is C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe You can also use the following PowerShell module to locate MSBuild: vssetup. powershell.


1 Answers

Now, if you want to change the build configuration you have to add the parameter
/p:config=<BUILD_CONFIG_NAME>

For example:

C:\Projects\TestDelphiApp001>msbuild /target:Build /p:config=Release

or

C:\Projects\TestDelphiApp001>msbuild /target:Build /p:config=Debug

Copied from original "question"; note community wiki.

like image 127
Craig Stuntz Avatar answered Nov 07 '22 21:11

Craig Stuntz