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. For more information, see Updating an existing application for MSBuild 15.0.
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, metapackages, 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.props and Directory.Build.targets are user-defined files that provide customizations to projects under a directory. Directory.Build.props is automatically imported from Microsoft.Common.props unless the property
ImportDirectoryBuildPropsis set to
false. Directory.Build.targets is automatically imported by Microsoft.Common.targets unless the property
ImportDirectoryBuildTargetsis set to
- 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" />