Show: Delphi C++
Display Preferences

MSBuild

From RAD Studio
Jump to: navigation, search

Go Up to Compiling, Building, and Running Applications Index


To build projects, the IDE now uses MSBuild instead of the previous internal build system. The build, compile, and make commands available in the IDE call the new build engine from Microsoft: MSBuild, which provides thorough dependency checking. MSBuild project files are XML-based, and contain sections that describe specific Items, Properties, Tasks, and Targets for the project.

For more information about MSBuild, see the Microsoft documentation at http://msdn.microsoft.com/en-us/default.aspx.

Migrating Projects to MSBuild

If you open a pre-existing project (such as one with .bdsproj extension), the IDE automatically converts the project to use MSBuild and changes the project extension to .dproj for a Delphi project or to .cbproj for a C++ project.

Project groups are also converted to MSBuild and given the project-group extension .groupproj.

Building Projects

You can build projects without knowing a great deal about MSBuild because the IDE handles all the details for you. The Project > Compile and Project > Build commands both invoke MSBuild, but the scope of each command is different.

You can also explicitly build projects from the command line by running MSBuild.exe with your .dproj file.

To invoke MSBuild in a custom command environment, choose Start | Programs | Embarcadero RAD Studio Tokyo | RAD Studio Command Prompt. This command window automatically has set both the path to the executable and the variable for your installation directory.

If you want to use MSBuild from the command line without using the RAD Studio Command Prompt, you should set the following environment variables yourself:

BDS=C:\Program Files (x86)\Embarcadero\Studio\19.0
FrameworkDir=C:\Windows\Microsoft.NET\Framework
FrameworkVersion=v3.5

Applying Your Own Custom Build Configurations

Several pages of the Project > Options dialog box allow you to save groups of options into a named build configuration. Two default build configurations are Debug and Release. C++Builder supports a Base configuration as well. You can use the Configuration Manager to selectively apply any named build configuration as the active build configuration for your project or project group.

Setting Build Events and Viewing Build Output

When you build a project, the results of the build appear in the Messages window, on the Output tab. You can specify pre-build and post-build events using the Project > Options > Build Events dialog box (C++Builder supports pre-link events as well). If you specify build events, the commands you specified and their results also appear in the Messages window. To control the level of output from MSBuild, use the Verbosity field on the Tools > Options > Environment Options page.

File Type Determines Build Order

MSBuild builds a project using the following order:

  1. .RC files
  2. .ASM files
  3. .PAS files
  4. .CPP files

The build proceeds downward through the directory or folder nodes in the Project Manager. Within each folder, files are built in order according to their file type. You can control build order by placing files within different folders or within virtual folders in the Project Manager.

See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance