- The Microsoft Build Engine is a platform for building applications.
- This engine, which is also known as MSBuild, provides an XML schema for a project file that controls how the build platform processes and builds software.
- By invoking msbuild.exe on your project or solution file, you can orchestrate and build products in environments where Visual Studio isn't installed.
- Visual Studio uses MSBuild to load and build managed projects.
- Command-line options let you set properties, execute specific targets, and set other options that control the build process.
MSBuild.exe MyProj.proj -property:Configuration=Debug
Project file
- The MSBuild project file format lets developers describe the items that are to be built, and also how they are to be built for different operating systems and configurations.
- In addition, the project file format lets developers author reusable build rules that can be factored into separate files so that builds can be performed consistently across different projects in the product.
- The following sections describe some of the basic elements of the MSBuild project file format.
- Properties represent key/value pairs that can be used to configure builds.
- Properties are declared by creating an element that has the name of the property as a child of a PropertyGroup element.
<PropertyGroup>
<BuildDir>Build</BuildDir>
</PropertyGroup>
- You can define a property conditionally by placing a
Condition
attribute in the element.
- The contents of conditional elements are ignored unless the condition evaluates to
true
.
- In the following example, the
Configuration
element is defined if it hasn't yet been defined.
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>