Skip to content

Commit 8cff4d4

Browse files
authored
Merge pull request #1357 from MicrosoftDocs/mikejo-msbld
Refresh msbuild docs
2 parents 752251a + 7ef0ec0 commit 8cff4d4

File tree

5 files changed

+33
-52
lines changed

5 files changed

+33
-52
lines changed

docs/msbuild/msbuild-toolset-toolsversion.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MSBuild Toolset (ToolsVersion) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "01/31/2018"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology: msbuild
@@ -13,7 +13,6 @@ helpviewer_keywords:
1313
- "MSBuild, targeting a specific .NET framework"
1414
- "multitargeting [MSBuild]"
1515
ms.assetid: 40040ee7-4620-4043-a6d8-ccba921421d1
16-
caps.latest.revision: 30
1716
author: Mikejo5000
1817
ms.author: mikejo
1918
manager: ghogen
@@ -28,7 +27,10 @@ MSBuild uses a Toolset of tasks, targets, and tools to build an application. Typ
2827

2928
```xml
3029
<Project ToolsVersion="15.0" ... </Project>
31-
```
30+
```
31+
32+
> [!NOTE]
33+
> Some project types use the `sdk` attribute instead of `ToolsVersion`. For more information, see [Packages, Metadata, and Frameworks](/dotnet/core/packages) and [Additions to the csproj format for .NET Core](/dotnet/core/tools/csproj).
3234
3335
## How the ToolsVersion Attribute Works
3436
When you create a project in Visual Studio, or upgrade an existing project, an attribute named `ToolsVersion` is automatically included in the project file and its value corresponds to the version of MSBuild that is included in the Visual Studio edition. For more information, see [Targeting a Specific .NET Framework Version](../ide/targeting-a-specific-dotnet-framework-version.md).
@@ -68,7 +70,7 @@ MSBuild uses a Toolset of tasks, targets, and tools to build an application. Typ
6870

6971
- By using <xref:Microsoft.Build.Utilities.ToolLocationHelper> methods
7072

71-
Toolset properties specify the paths of the tools. MSBuild uses the value of the `ToolsVersion` attribute in the project file to locate the corresponding registry key, and then uses the information in the registry key to set the Toolset properties. For example, if `ToolsVersion` has the value `12.0`, then MSBuild sets the Toolset properties according to this registry key: HKLM\Software\Microsoft\MSBuild\ToolsVersions\12.0.
73+
Toolset properties specify the paths of the tools. Starting in Visual Studio 2017, MSBuild no longer has a fixed location. By default, it is located in the MSBuild\15.0\Bin folder relative to the Visual Studio installation location. In earlier versions, MSBuild uses the value of the `ToolsVersion` attribute in the project file to locate the corresponding registry key, and then uses the information in the registry key to set the Toolset properties. For example, if `ToolsVersion` has the value `12.0`, then MSBuild sets the Toolset properties according to this registry key: HKLM\Software\Microsoft\MSBuild\ToolsVersions\12.0.
7274

7375
These are Toolset properties:
7476

@@ -91,7 +93,7 @@ MSBuild uses a Toolset of tasks, targets, and tools to build an application. Typ
9193
- <xref:Microsoft.Build.Utilities.ToolLocationHelper.GetPathToBuildTools%2A> returns the path of the build tools.
9294

9395
### Sub-toolsets
94-
As described earlier in this topic, MSBuild uses a registry key to specify the path of the basic tools. If the key has a subkey, MSBuild uses it to specify the path of a sub-toolset that contains additional tools. In this case, the Toolset is defined by combining the property definitions that are defined in both keys.
96+
For versions MSBuild prior to 15.0, MSBuild uses a registry key to specify the path of the basic tools. If the key has a subkey, MSBuild uses it to specify the path of a sub-toolset that contains additional tools. In this case, the Toolset is defined by combining the property definitions that are defined in both keys.
9597

9698
> [!NOTE]
9799
> If toolset property names collide, the value that's defined for the subkey path overrides the value that's defined for the root key path.
@@ -102,7 +104,7 @@ MSBuild uses a Toolset of tasks, targets, and tools to build an application. Typ
102104

103105
- "11.0" specifies the .NET Framework 4.5 sub-toolset
104106

105-
- "12.0" specifies the .NET Framework 4.5.1 sub-toolset
107+
- "12.0" specifies the .NET Framework 4.5.1 sub-toolset
106108

107109
Sub-toolsets 10.0 and 11.0 should be used with ToolsVersion 4.0. In later versions, the sub-toolset version and the ToolsVersion should match.
108110

docs/msbuild/standard-and-custom-toolset-configurations.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Standard and Custom Toolset Configurations | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "01/31/2018"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology: msbuild
@@ -11,7 +11,6 @@ helpviewer_keywords:
1111
- "MSBuild, custom toolset configurations"
1212
- "MSBuild, msbuild.exe.config"
1313
ms.assetid: 15a048c8-5ad3-448e-b6e9-e3c5d7147ed2
14-
caps.latest.revision: 31
1514
author: Mikejo5000
1615
ms.author: mikejo
1716
manager: ghogen
@@ -22,30 +21,27 @@ ms.workload:
2221
An MSBuild Toolset contains references to tasks, targets, and tools that you can use to build an application project. MSBuild includes a standard Toolset, but you can also create custom Toolsets. For information about how to specify a Toolset, see [Toolset (ToolsVersion)](../msbuild/msbuild-toolset-toolsversion.md)
2322

2423
## Standard Toolset Configurations
25-
MSBuild 12.0 includes the following standard Toolsets:
24+
MSBuild 15.0 includes the following standard Toolsets:
2625

2726
|ToolsVersion|Toolset Path (as specified in the MSBuildToolsPath or MSBuildBinPath build property)|
2827
|------------------|--------------------------------------------------------------------------------------------|
2928
|2.0|*Windows installation path*\Microsoft.Net\Framework\v2.0.50727\|
3029
|3.5|*Windows installation path*\Microsoft.NET\Framework\v3.5\|
3130
|4.0|*Windows installation path*\Microsoft.NET\Framework\v4.0.30319\|
32-
|12.0|*%ProgramFiles%*\MSBuild\12.0\bin|
31+
|15.0|*Visual Studio installation path*\MSBuild\15.0\bin|
3332

34-
The `ToolsVersion` value determines which Toolset is used by a project that Visual Studio generates. In [!INCLUDE[vs_dev12](../extensibility/includes/vs_dev12_md.md)] the default value is "12.0" (no matter what the version specified in the project file), but you can override that attribute by using the **/toolsversion** switch at a command prompt. For information about this attribute and other ways to specify the `ToolsVersion`, see [Overriding ToolsVersion Settings](../msbuild/overriding-toolsversion-settings.md).
33+
The `ToolsVersion` value determines which Toolset is used by a project that Visual Studio generates. In Visual Studio 2017, the default value is "15.0" (no matter what the version specified in the project file), but you can override that attribute by using the **/toolsversion** switch at a command prompt. For information about this attribute and other ways to specify the `ToolsVersion`, see [Overriding ToolsVersion Settings](../msbuild/overriding-toolsversion-settings.md).
3534

36-
If the `ToolsVersion` isn't specified, the registry key **HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\\<Version Number\>\DefaultToolsVersion** defines the `ToolsVersion`, which is always 2.0.
37-
38-
The following registry keys specify the installation path of MSBuild.exe.
35+
Visual Studio 2017 does not use a registry key for the path to MSBuild. For versions of MSBuild prior to 15.0 that are installed with Visual Studio 2017, the following registry keys specify the installation path of MSBuild.exe.
3936

4037
|Registry Key|Key Name|String Key Value|
4138
|------------------|--------------|----------------------|
4239
|\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\2.0\|MSBuildToolsPath|.NET Framework 2.0 Install Path|
4340
|\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ MSBuild\ToolsVersions\3.5\|MSBuildToolsPath|.NET Framework 3.5 Install Path|
4441
|\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ MSBuild\ToolsVersions\4.0\|MSBuildToolsPath|.NET Framework 4 Install Path|
45-
|\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ MSBuild\ToolsVersions\12.0\|MSBuildToolsPath|MSBuild Install Path|
4642

4743
### Sub-toolsets
48-
If the registry key in the previous table has a subkey, MSBuild uses it to determine the path of a sub-toolset may override the path in the parent toolset. The following subkey is an example:
44+
If the registry key in the previous table has a subkey, MSBuild uses it to determine the path of a sub-toolset that overrides the path in the parent toolset. The following subkey is an example:
4945

5046
\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0\12.0
5147

@@ -59,11 +55,11 @@ An MSBuild Toolset contains references to tasks, targets, and tools that you can
5955
## Custom Toolset Definitions
6056
When a standard Toolset does not fulfill your build requirements, you can create a custom Toolset. For example, you may have a build lab scenario in which you must have a separate system for building [!INCLUDE[vcprvc](../code-quality/includes/vcprvc_md.md)] projects. By using a custom Toolset, you can assign custom values to the `ToolsVersion` attribute when you create projects or run MSBuild.exe. By doing this, you can also use the `$(MSBuildToolsPath)` property to import .targets files from that directory, as well as defining your own custom toolset properties that can be used for any project that uses that toolset.
6157

62-
Specify a custom Toolset in the configuration file for MSBuild.exe (or for the custom tool that hosts the MSBuild engine if that is what you are using). For example, the configuration file for MSBuild.exe could include the following Toolset definition if you wished to override the default behavior of ToolsVersion 12.0.
58+
Specify a custom Toolset in the configuration file for MSBuild.exe (or for the custom tool that hosts the MSBuild engine if that is what you are using). For example, the configuration file for MSBuild.exe could include the following Toolset definition if you wished to override the default behavior of ToolsVersion 15.0.
6359

6460
```xml
65-
<msbuildToolsets default="12.0">
66-
<toolset toolsVersion="12.0">
61+
<msbuildToolsets default="15.0">
62+
<toolset toolsVersion="15.0">
6763
<property name="MSBuildToolsPath"
6864
value="C:\SpecialPath" />
6965
</toolset>
@@ -76,7 +72,7 @@ An MSBuild Toolset contains references to tasks, targets, and tools that you can
7672
<configSections>
7773
<section name="msbuildToolsets"
7874
Type="Microsoft.Build.BuildEngine.ToolsetConfigurationSection,
79-
Microsoft.Build.Engine, Version=12.0.0.0, Culture=neutral,
75+
Microsoft.Build.Engine, Version=15.1.0.0, Culture=neutral,
8076
PublicKeyToken=b03f5f7f11d50a3a"
8177
</section>
8278
</configSections>

docs/msbuild/walkthrough-using-msbuild.md

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ ms.topic: "article"
1010
helpviewer_keywords:
1111
- "MSBuild, tutorial"
1212
ms.assetid: b8a8b866-bb07-4abf-b9ec-0b40d281c310
13-
caps.latest.revision: 32
1413
author: Mikejo5000
1514
ms.author: mikejo
1615
manager: ghogen
@@ -57,45 +56,33 @@ MSBuild is the build platform for Microsoft and Visual Studio. This walkthrough
5756
The project file appears in the code editor.
5857

5958
## Targets and Tasks
60-
Project files are XML-formatted files with the root node [Project](../msbuild/project-element-msbuild.md).
59+
Project files are XML-formatted files with the root node [Project](../msbuild/project-element-msbuild.md).
6160

6261
```xml
6362
<?xml version="1.0" encoding="utf-8"?>
64-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
63+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6564
```
6665

67-
You must specify the xmlns namespace in the Project element.
66+
You must specify the xmlns namespace in the Project element. If `ToolsVersion` is present in a new project, it must be "15.0".
6867

69-
The work of building an application is done with [Target](../msbuild/target-element-msbuild.md) and [Task](../msbuild/task-element-msbuild.md) elements.
68+
The work of building an application is done with [Target](../msbuild/target-element-msbuild.md) and [Task](../msbuild/task-element-msbuild.md) elements.
7069

7170
- A task is the smallest unit of work, in other words, the "atom" of a build. Tasks are independent executable components which may have inputs and outputs. There are no tasks currently referenced or defined in the project file. You add tasks to the project file in the sections below. For more information, see the [Tasks](../msbuild/msbuild-tasks.md) topic.
7271

73-
- A target is a named sequence of tasks. There are two targets at the end of the project file that are currently enclosed in HTML comments: BeforeBuild and AfterBuild.
72+
- A target is a named sequence of tasks. For more information, see the [Targets](../msbuild/msbuild-targets.md) topic.
7473

75-
```xml
76-
<Target Name="BeforeBuild">
77-
</Target>
78-
<Target Name="AfterBuild">
79-
</Target>
80-
```
81-
82-
For more information, see the [Targets](../msbuild/msbuild-targets.md) topic.
83-
84-
The Project node has an optional DefaultTargets attribute that selects the default target to build, in this case Build.
85-
86-
```xml
87-
<Project ToolsVersion="12.0" DefaultTargets="Build" ...
88-
```
89-
90-
The Build target is not defined in the project file. Instead, it is imported from the file Microsoft.CSharp.targets by using the [Import](../msbuild/import-element-msbuild.md) element.
74+
The default target is not defined in the project file. Instead, it is specified in imported projects. The [Import](../msbuild/import-element-msbuild.md) element specifies imported projects. For example, in a C# project, the default target is imported from the file Microsoft.CSharp.targets.
9175

9276
```xml
9377
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9478
```
9579

96-
Imported files are effectively inserted into the project file wherever they are referenced.
80+
Imported files are effectively inserted into the project file wherever they are referenced.
81+
82+
> [!NOTE]
83+
> Some project types, such as .NET Core, use a simplified schema with an `Sdk` attribute instead of `ToolsVersion`. These projects have implicit imports and different default attribute values.
9784
98-
MSBuild keeps track of the targets of a build, and guarantees that each target is built no more than once.
85+
MSBuild keeps track of the targets of a build, and guarantees that each target is built no more than once.
9986

10087
## Adding a Target and a Task
10188
Add a target to the project file. Add a task to the target that prints out a message.
@@ -155,9 +142,6 @@ MSBuild is the build platform for Microsoft and Visual Studio. This walkthrough
155142

156143
By alternating between the code editor and the command window, you can change the project file and quickly see the results.
157144

158-
> [!NOTE]
159-
> If you run msbuild without the /t command switch, msbuild builds the target given by the DefaultTarget attribute of the Project element, in this case "Build". This builds the Windows Forms application BuildApp.exe.
160-
161145
## Build Properties
162146
Build properties are name-value pairs that guide the build. Several build properties are already defined at the top of the project file:
163147

@@ -175,10 +159,10 @@ MSBuild is the build platform for Microsoft and Visual Studio. This walkthrough
175159
All properties are child elements of PropertyGroup elements. The name of the property is the name of the child element, and the value of the property is the text element of the child element. For example,
176160

177161
```xml
178-
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion>
162+
<TargetFrameworkVersion>v15.0</TargetFrameworkVersion>
179163
```
180164

181-
defines the property named TargetFrameworkVersion, giving it the string value "v12.0".
165+
defines the property named TargetFrameworkVersion, giving it the string value "v15.0".
182166

183167
Build properties may be redefined at any time. If
184168

@@ -220,7 +204,7 @@ $(PropertyName)
220204

221205
```
222206
Configuration is Debug
223-
MSBuildToolsPath is C:\Program Files\MSBuild\12.0\bin
207+
MSBuildToolsPath is C:\Program Files (x86)\Microsoft Visual Studio\2017\<Visual Studio SKU>\MSBuild\15.0\Bin
224208
```
225209

226210
> [!NOTE]

docs/msbuild/what-s-new-in-msbuild-15-0.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ ms.technology: msbuild
88
ms.tgt_pltfrm: ""
99
ms.topic: "article"
1010
ms.assetid: 9976b6fd-d052-4017-b848-35b5bf4b2f66
11-
caps.latest.revision: 23
1211
author: Mikejo5000
1312
ms.author: mikejo
1413
manager: ghogen
@@ -35,7 +34,7 @@ MSBuild is now available as part of the [.NET Core SDK](https://www.microsoft.co
3534
- The `SDK35ToolsPath` and `SDK40ToolsPath` properties point to the .NET Framework SDK that's packaged with this version of Visual Studio (for example, 10.0A for the 4.X tools).
3635

3736
## Updates
38-
- [Project Element](../msbuild/project-element-msbuild.md) has a new `SDK` attribute. Also the `Xmlns` attribute is now optional.
37+
- [Project Element](../msbuild/project-element-msbuild.md) has a new `SDK` attribute. Also the `Xmlns` attribute is now optional. For more information, see [Packages, Metadata, and Frameworks](/dotnet/core/packages) and [Additions to the csproj format for .NET Core](/dotnet/core/tools/csproj).
3938
- [Item Element](../msbuild/item-element-msbuild.md) outside targets has a new `Update` attribute. Also, the restriction on the `Remove` attribute has been eliminated.
4039
- `Directory.Build.props` is a user-defined file that provides customizations to projects under a directory. This file is automatically imported from Microsoft.Common.props unless the property `ImportDirectoryBuildTargets` is set to **false**. `Directory.Build.targets` is imported by Microsoft.Common.targets.
4140
- 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](../msbuild/item-element-msbuild.md).
Binary file not shown.

0 commit comments

Comments
 (0)