Building a Project Using an MSBuild Command
The IDE uses Microsoft's MSBuild engine to build a project. You can build projects without knowing anything about MSBuild; the IDE handles all the details for you. However, you can also directly build the project using MSBuild command-line syntax as described here. When you build a project, the results of the build appear in the Output pane of the Messages window. If you have entered build events, the build output pane displays the commands you specified and their results.
MSBuild command-line syntax has the form:
MSBuild <projectname> [/t:<target name>][/p:config=<configuration_name>][target:Deploy][/p:platform=<platform_node_name>]
Building a Project Using the Command Line
- From the Start menu, select Embarcadero RAD Studio | RAD Studio Command Prompt. The command prompt window automatically sets the environment for using RAD Studio tools such as MSBuild.exe.
- Note: In later versions of Windows OS, the shortcut will be available in your application list menu.
- Navigate to the directory that contains your project, such as C:\Users\<user>\Documents\Embarcadero\Studio\Projects\MyProject.
msbuildbut do not press
- Enter your project name, such as
TelePoll.dproj(a Delphi project) or
UserInfo.cbproj(a C++ project).If the project is not in the current directory, you must include the full path name to the project directory.
- To specify a target, enter the
/t:tag followed by one of the targets specified in your project file. The three standard target names are
Cleanmeans to clean the project, removing generated files such as object code.
Cleancorresponds to the Project Manager context menu item Clean.
Makemeans to compile the project.
Makecorresponds to the context menu item Compile.
Buildmeans to build the project.
Buildcorresponds to the context menu item Build.The three targets are similar to the Clean, Compile, and Build commands on the context menu in the Project Manager. The default target is
- To specify a configuration, enter the configuration name after
/p:config =.If you do not specify a configuration, MSBuild uses the current active configuration.To specify a configuration, use the name of one of the existing build configurations in your project. This can be either a default configuration, such as Debug, or a configuration you have added to the project. If the configuration name has a space in it, enter the name bounded by double quotes, such as:
/p:config ="My config"
- To prepare your application for deployment, add the
- Enter any other options and press Return to begin the build.
Tip To display online help for MSBuild (including a full example command line), open the RAD Studio Command Prompt (see Step 1) and enter
For more information about MSBuild, see Microsoft documentation at http://msdn.microsoft.com/library/default.aspx.
Building an Android or iOS Application Using the Command Line
Creating the apk or ipa package file requires the *.deployproj file. This file is only generated from the IDE. You need to deploy your application form the IDE each time you make changes in the Deployment Manager to have the *.deployproj file updated. Click Deploy to create again the file.
From the IDE:
- Select the options for your project on the Projects Window: Build Configuration and target platform.
- Compile the project.
- Go to Project > Deployment and click Deploy .
- Note: This generates a *.deployproj file that works with MSBuild.
- Save the project.
- Follow the steps to Build a Project Using the Command Line specifying the target platform:
msbuild <project_name> ... /p:platform=Android / iOSDevice64
To clarify, consider the following sample MSBuild commands:
- To create an
.apkinstaller to deploy your C++Builder project to the Android target platform, use a command similar to the following syntax:
msbuild MyApps_CBuilder.cbproj /t:Build /p:Configuration=Debug /target:Deploy /p:platform=Android
- To deploy your Delphi project to the iOS32 target platform, use a command similar to the following syntax:
msbuild MyProj_Delphi.dproj /t:Build /p:Configuration=Debug /target:Deploy /p:platform=iOSDevice32