What's New in MSBuild 15
MSBuild is now available as part of the .NET Core SDK and can build .NET Core projects on Windows, macOS, and Linux.
MSBuild is now installed in a folder under each version of Visual Studio. For example,
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild. You can also use the following PowerShell module to locate MSBuild: vssetup.powershell.
MSBuild is no longer installed in the Global Assembly Cache. To reference MSBuild programmatically, use NuGet packages.
The following MSBuild properties have been updated due to the new version number.
MSBuildToolsVersionfor this version of the tools is 15.0. The assembly version is 18.104.22.168.
MSBuildToolsPathno longer has a fixed location. By default, it is located in the MSBuild\15.0\Bin folder relative to the Visual Studio installation location, but the Visual Studio installation location can be changed at install time.
ToolsVersionvalues are no longer set in the registry.
SDK40ToolsPathproperties point to the .NET Framework SDK that's packaged with this version of Visual Studio (for example, 10.0A for the 4.X tools).
- Project Element has a new
SDKattribute. Also the
Xmlnsattribute is now optional. For more information on the
SDKattribute, see How to: Use MSBuild Project SDKs, Packages, Metadata, and Frameworks and Additions to the csproj format for .NET Core.
- Item Element outside targets has a new
Updateattribute. Also, the restriction on the
Removeattribute has been eliminated.
Directory.Build.propsis a user-defined file that provides customizations to projects under a directory. This file is automatically imported from Microsoft.Common.props unless the property
ImportDirectoryBuildTargetsis set to false.
Directory.Build.targetsis imported by Microsoft.Common.targets.
- Any metadata with a name that doesn't conflict with the current list of attributes can optionally be expressed as an attribute. For more information, see Item Element.
New property functions
EnsureTrailingSlashadds a trailing slash to a path if one doesn't already exist.
NormalizePathcombines path elements and ensures that the output string has the correct directory separator characters for the current operating system.
NormalizeDirectorycombines path elements, ensures a trailing slash, and ensures that the output string has the correct directory separator characters for the current operating system.
GetPathOfFileAbovereturns the path of the file immediately preceding this one. It is functionally equivalent to calling
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />