You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/msbuild/msbuild-toolset-toolsversion.md
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "MSBuild Toolset (ToolsVersion) | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/04/2016"
4
+
ms.date: "01/31/2018"
5
5
ms.reviewer: ""
6
6
ms.suite: ""
7
7
ms.technology: msbuild
@@ -13,7 +13,6 @@ helpviewer_keywords:
13
13
- "MSBuild, targeting a specific .NET framework"
14
14
- "multitargeting [MSBuild]"
15
15
ms.assetid: 40040ee7-4620-4043-a6d8-ccba921421d1
16
-
caps.latest.revision: 30
17
16
author: Mikejo5000
18
17
ms.author: mikejo
19
18
manager: ghogen
@@ -28,7 +27,10 @@ MSBuild uses a Toolset of tasks, targets, and tools to build an application. Typ
28
27
29
28
```xml
30
29
<ProjectToolsVersion="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).
32
34
33
35
## How the ToolsVersion Attribute Works
34
36
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
68
70
69
71
- By using <xref:Microsoft.Build.Utilities.ToolLocationHelper> methods
70
72
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.
72
74
73
75
These are Toolset properties:
74
76
@@ -91,7 +93,7 @@ MSBuild uses a Toolset of tasks, targets, and tools to build an application. Typ
91
93
-<xref:Microsoft.Build.Utilities.ToolLocationHelper.GetPathToBuildTools%2A> returns the path of the build tools.
92
94
93
95
### 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.
95
97
96
98
> [!NOTE]
97
99
> 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
102
104
103
105
- "11.0" specifies the .NET Framework 4.5 sub-toolset
104
106
105
-
- "12.0" specifies the .NET Framework 4.5.1 sub-toolset
107
+
- "12.0" specifies the .NET Framework 4.5.1 sub-toolset
106
108
107
109
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.
Copy file name to clipboardExpand all lines: docs/msbuild/standard-and-custom-toolset-configurations.md
+10-14Lines changed: 10 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Standard and Custom Toolset Configurations | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/04/2016"
4
+
ms.date: "01/31/2018"
5
5
ms.reviewer: ""
6
6
ms.suite: ""
7
7
ms.technology: msbuild
@@ -11,7 +11,6 @@ helpviewer_keywords:
11
11
- "MSBuild, custom toolset configurations"
12
12
- "MSBuild, msbuild.exe.config"
13
13
ms.assetid: 15a048c8-5ad3-448e-b6e9-e3c5d7147ed2
14
-
caps.latest.revision: 31
15
14
author: Mikejo5000
16
15
ms.author: mikejo
17
16
manager: ghogen
@@ -22,30 +21,27 @@ ms.workload:
22
21
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)
23
22
24
23
## Standard Toolset Configurations
25
-
MSBuild 12.0 includes the following standard Toolsets:
24
+
MSBuild 15.0 includes the following standard Toolsets:
26
25
27
26
|ToolsVersion|Toolset Path (as specified in the MSBuildToolsPath or MSBuildBinPath build property)|
|15.0|*Visual Studio installation path*\MSBuild\15.0\bin|
33
32
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).
35
34
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.
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:
@@ -59,11 +55,11 @@ An MSBuild Toolset contains references to tasks, targets, and tools that you can
59
55
## Custom Toolset Definitions
60
56
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.
61
57
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.
63
59
64
60
```xml
65
-
<msbuildToolsetsdefault="12.0">
66
-
<toolsettoolsVersion="12.0">
61
+
<msbuildToolsetsdefault="15.0">
62
+
<toolsettoolsVersion="15.0">
67
63
<propertyname="MSBuildToolsPath"
68
64
value="C:\SpecialPath" />
69
65
</toolset>
@@ -76,7 +72,7 @@ An MSBuild Toolset contains references to tasks, targets, and tools that you can
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".
68
67
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.
70
69
71
70
- 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.
72
71
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.
74
73
75
-
```xml
76
-
<TargetName="BeforeBuild">
77
-
</Target>
78
-
<TargetName="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.
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.
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.
97
84
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.
99
86
100
87
## Adding a Target and a Task
101
88
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
155
142
156
143
By alternating between the code editor and the command window, you can change the project file and quickly see the results.
157
144
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
-
161
145
## Build Properties
162
146
Build properties are name-value pairs that guide the build. Several build properties are already defined at the top of the project file:
163
147
@@ -175,10 +159,10 @@ MSBuild is the build platform for Microsoft and Visual Studio. This walkthrough
175
159
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,
Copy file name to clipboardExpand all lines: docs/msbuild/what-s-new-in-msbuild-15-0.md
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,6 @@ ms.technology: msbuild
8
8
ms.tgt_pltfrm: ""
9
9
ms.topic: "article"
10
10
ms.assetid: 9976b6fd-d052-4017-b848-35b5bf4b2f66
11
-
caps.latest.revision: 23
12
11
author: Mikejo5000
13
12
ms.author: mikejo
14
13
manager: ghogen
@@ -35,7 +34,7 @@ MSBuild is now available as part of the [.NET Core SDK](https://www.microsoft.co
35
34
- 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).
36
35
37
36
## 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).
39
38
-[Item Element](../msbuild/item-element-msbuild.md) outside targets has a new `Update` attribute. Also, the restriction on the `Remove` attribute has been eliminated.
40
39
-`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.
41
40
- 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).
0 commit comments