MSBUILD Reserved Properties

When you use MSBuild, a handful of properties are available to you out of the box that cannot be modified. These are known as reserved properties. Following table presents all reserved properties in MSBuild 4.

MSBuildExtensionsPath The full path to where MSBuild extensions are located. This is typically under the Program Files folder. Note that now this always points to the 32-bit location.
MSBuildExtensionsPath32 The full path where MSBuild 32-bit extensions are located. This typically is located under the Program Files folder. For 32-bit machines, this value will be the same as MSBuildExtensionsPath.
MSBuildExtensionsPath64* The full path where MSBuild 64-bit extensions are located. This typically is under the Program Files folder. For 32-bit machines, this value will be empty.
MSBuildLastTaskResult* This value holds the return value from the previous task. It will be true if the task completed successfully, and false otherwise.
MSBuildNodeCount The maximum number of nodes (processes) that are being used to build the project. If the /m switch is not used, then this value will be 1. If you use the /m switch without specifying a number of nodes, then the default is the number of CPUs available.
MSBuildOverrideTasksPath * MSBuild 4.0 introduces override tasks, which are tasks that force themselves to be used instead of any other defined task with the same name, and this property points to a file that contains the overrides. The override tasks feature is used internally to help MSBuild 4.0 work well with other versions of MSBuild.
MSBuildProgramFiles32 * This contains the path to the 32-bit Program Files folder. To get the value for the default Program Files folder, use $(ProgramFiles).
MSBuildProjectDefault Targets Contains the list of the default targets.
MSBuildProjectDefaultTargets Contains a list of the default targets.
MSBuildProjectDirectory The full path to the directory where the project file is located.
MSBuildProjectDirectoryNoRoot The full path to the directory where the project file is located, excluding the root directory.
MSBuildProjectExtension The extension of the project file, including the period.
MSBuildProjectFile The name of the project file, including the extension.
MSBuildProjectFullPath The full path to the project file.
MSBuildProjectName The name of the project file, without the extension.
MSBuildStartupDirectory The full path to the folder where the MSBuild process is invoked.
MSBuildThisFile * Contains the file name, including the extension, of the file that contains the property usage. This differs from MSBuildProjectFile in that MSBuildProjectFile always refers to the file that was invoked, not any imported file name.
MSBuildThisFileDirectory* This is the full path to the directory that contains the file that is currently being executed.
MSBuildThisFileDirectoryNoRoot * Same as MSBuildThisFileDirectory without the root
MSBuildThisFileDirectoryNoRoot* The same as MSBuildThisFileDirectory, except with the root removed.
MSBuildThisFileExtension * The extension of the file referenced by MSBuildThisFile.
MSBuildThisFileFullPath* The full path to the file that is currently executing.
MSBuildThisFileName* The name of the file, excluding the extension and path, of the currently executing file.
MSBuildToolsPath(MSBuildBinPath) The full path to the location where the MSBuild binaries are located. In MSBuild 2.0, this property is named MSBuildBinPath and is deprecated in MSBuild 3.5 and later. MSBuildBinPath and MSBuildToolsPath have the same value, but you should use only MSBuildToolsPath.
MSBuildToolsVersion The version of the tools being used to build the project. Possible values include 2.0, 3.5, and 4.0. The default value is 2.0.

* Denotes parameters new with MSBuild 4.0.

This table is copied from the book “Inside Microsoft Build Engine 2.”

Comments

210 responses to “MSBUILD Reserved Properties”

Leave a Reply