Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
MSBuild provides a set of predefined properties that store information about the project file and the MSBuild binaries. These properties are evaluated in the same manner as other MSBuild properties. For example, to use the MSBuildProjectFile property, you type $(MSBuildProjectFile).
MSBuild uses the values in the following table to predefine reserved and well-known properties. Reserved properties cannot be overridden, and most well-known properties shouldn't be overridden except in advanced scenarios.
Reserved and well-known properties
The table in this section shows the MSBuild predefined properties. The example column in the table relates to the following example project file, assumed to be located at C:\Source\Repos\ConsoleApp1\ConsoleApp1, and shows an example of the values these properties have when accessed in the project file, when MSBuild is invoked with no special command-line options.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
Properties specific to C++ projects
The following properties represent the path to the C++ MSBuild import files, such as .props and .targets files, for various MSVC Build Tools (toolset) versions and target operating systems. The files in these folders represent the C++ build infrastructure and are essential for building any C++ project with MSBuild.
| Property | Reserved or well-known | Description | Example |
|---|---|---|---|
AndroidTargetsPath |
Well-known | Path to C++ MSBuild import files for Android builds. | C:\Program Files\Microsoft Visual Studio\2022\MSBuild\Microsoft\MDD\Android\V150\ |
iOSTargetsPath |
Well-known | Path to C++ MSBuild import files for iOS builds. | C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\MDD\iOS\V150\ |
VCTargetsPath |
Well-known | Path to C++ MSBuild files that support the C++ build system. | C:\Program Files\Microsoft Visual Studio\2022\MSBuild\Microsoft\VC\v170\ |
VCTargetsPath10 |
Well-known | Path to C++ MSBuild files that support the Visual Studio 2010 toolset. | C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\ |
VCTargetsPath11 |
Well-known | Path to the MSBuild import files for the Visual Studio 2012 (V110) toolset. | C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\ |
VCTargetsPath12 |
Well-known | Path to the MSBuild import files for the Visual Studio 2013 (V120) toolset. | C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\ |
VCTargetsPath14 |
Well-known | Path to the MSBuild import files for the Visual Studio 2015 (V140) toolset. | C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\ |
Names that conflict with MSBuild elements
In addition to the above, names corresponding to MSBuild language elements cannot be used for user-defined properties, items, or item metadata:
- VisualStudioProject
- Target
- PropertyGroup
- Output
- ItemGroup
- UsingTask
- ProjectExtensions
- OnError
- ImportGroup
- Choose
- When
- Otherwise