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
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -17,10 +17,10 @@ ms.workload:
17
17
- "multiple"
18
18
---
19
19
# MSBuild Toolset (ToolsVersion)
20
-
MSBuild uses a toolset of tasks, targets, and tools to build an application. Typically, a MSBuild toolset includes a *microsoft.common.tasks* file, a *microsoft.common.targets* file, and compilers such as *csc.exe* and *vbc.exe*. Most toolsets can be used to compile applications to more than one version of the .NET Framework and more than one system platform. However, the MSBuild 2.0 Toolset can be used to target only the .NET Framework 2.0.
20
+
MSBuild uses a Toolset of tasks, targets, and tools to build an application. Typically, a MSBuild Toolset includes a *microsoft.common.tasks* file, a *microsoft.common.targets* file, and compilers such as *csc.exe* and *vbc.exe*. Most Toolsets can be used to compile applications to more than one version of the .NET Framework and more than one system platform. However, the MSBuild 2.0 Toolset can be used to target only the .NET Framework 2.0.
21
21
22
22
## ToolsVersion attribute
23
-
Specify the toolset in the `ToolsVersion` attribute on the [Project](../msbuild/project-element-msbuild.md) element in the project file. The following example specifies that the project should be built by using the MSBuild 15.0 Toolset.
23
+
Specify the Toolset in the `ToolsVersion` attribute on the [Project](../msbuild/project-element-msbuild.md) element in the project file. The following example specifies that the project should be built by using the MSBuild 15.0 Toolset.
24
24
25
25
```xml
26
26
<ProjectToolsVersion="15.0" ... </Project>
@@ -34,26 +34,26 @@ MSBuild uses a toolset of tasks, targets, and tools to build an application. Typ
34
34
35
35
When a `ToolsVersion` value is defined in a project file, MSBuild uses that value to determine the values of the Toolset properties that are available to the project. One Toolset property is `$(MSBuildToolsPath)`, which specifies the path of the .NET Framework tools. Only that Toolset property (or `$(MSBuildBinPath)`), is required.
36
36
37
-
Starting in Visual Studio 2013, the MSBuild Toolset version is the same as the Visual Studio version number. MSBuild defaults to this toolset within Visual Studio and on the command line, regardless of the toolset version specified in the project file. This behavior can be overridden by using the /ToolsVersion flag. For more information, see [Override ToolsVersion settings](../msbuild/overriding-toolsversion-settings.md).
37
+
Starting in Visual Studio 2013, the MSBuild Toolset version is the same as the Visual Studio version number. MSBuild defaults to this Toolset within Visual Studio and on the command line, regardless of the Toolset version specified in the project file. This behavior can be overridden by using the /ToolsVersion flag. For more information, see [Override ToolsVersion settings](../msbuild/overriding-toolsversion-settings.md).
38
38
39
39
In the following example, MSBuild finds the *Microsoft.CSharp.targets* file by using the `MSBuildToolsPath` reserved property.
You can modify the value of `MSBuildToolsPath` by defining a custom toolset. For more information, see [Standard and custom toolset configurations](../msbuild/standard-and-custom-toolset-configurations.md)
45
+
You can modify the value of `MSBuildToolsPath` by defining a custom Toolset. For more information, see [Standard and custom Toolset configurations](../msbuild/standard-and-custom-toolset-configurations.md)
46
46
47
47
When you build a solution on the command line and specify a `ToolsVersion` for *msbuild.exe*, all projects and their project-to-project dependencies are built according to that `ToolsVersion`, even if each project in the solution specifies its own `ToolsVersion`. To define the `ToolsVersion` value on a per project basis, see [Overriding ToolsVersion settings](../msbuild/overriding-toolsversion-settings.md).
48
48
49
49
The `ToolsVersion` attribute is also used for project migration. For example, if you open a Visual Studio 2008 project in Visual Studio 2010, the project file is updated to include ToolsVersion="4.0". If you then try to open that project in Visual Studio 2008, it doesn't recognize the upgraded `ToolsVersion` and therefore builds the project as though the attribute was still set to 3.5.
50
50
51
-
Visual Studio 2010 and Visual Studio 2012 use a ToolsVersion of 4.0. Visual Studio 2013 uses a ToolsVersion of 12.0. Visual Studio 2015 uses ToolsVersion 14.0, and Visual Studio 2017 uses ToolsVersion 15.0. In many cases, you can open the project in multiple versions of Visual Studio without modification. Visual Studio always uses the correct toolset, but you will be notified if the version used does not match the version in the project file. In almost all cases, this warning is benign as the toolsets are compatible in most cases.
51
+
Visual Studio 2010 and Visual Studio 2012 use a ToolsVersion of 4.0. Visual Studio 2013 uses a ToolsVersion of 12.0. Visual Studio 2015 uses ToolsVersion 14.0, and Visual Studio 2017 uses ToolsVersion 15.0. In many cases, you can open the project in multiple versions of Visual Studio without modification. Visual Studio always uses the correct Toolset, but you will be notified if the version used does not match the version in the project file. In almost all cases, this warning is benign as the Toolsets are compatible in most cases.
52
52
53
53
Sub-toolsets, which are described later in this topic, allow MSBuild to automatically switch which set of tools to use based on the context in which the build is being run. For example, MSBuild uses a newer set of tools when it's run in Visual Studio 2012 than when it's run in Visual Studio 2010, without your having to explicitly change the project file.
54
54
55
55
## Toolset implementation
56
-
Implement a toolset by selecting the paths of the various tools, targets, and tasks that make up the toolset. The tools in the toolset that MSBuild defines come from the following sources:
56
+
Implement a Toolset by selecting the paths of the various tools, targets, and tasks that make up the Toolset. The tools in the Toolset that MSBuild defines come from the following sources:
57
57
58
58
- The .NET Framework folder.
59
59
@@ -90,10 +90,10 @@ Alternately, you can determine the Toolset programmatically by calling the metho
90
90
-<xref:Microsoft.Build.Utilities.ToolLocationHelper.GetPathToBuildTools%2A> returns the path of the build tools.
91
91
92
92
### Sub-toolsets
93
-
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.
93
+
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.
94
94
95
95
> [!NOTE]
96
-
> 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.
96
+
> 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.
97
97
98
98
Sub-toolsets become active in the presence of the `VisualStudioVersion` build property. This property may take one of these values:
99
99
@@ -112,5 +112,5 @@ MSBuild provides overloads for the `ToolLocationHelper` methods that add a `Visu
112
112
Sub-toolsets were introduced in the .NET Framework 4.5.
113
113
114
114
## See also
115
-
[Standard and custom toolset configurations](../msbuild/standard-and-custom-toolset-configurations.md)
115
+
[Standard and custom Toolset configurations](../msbuild/standard-and-custom-toolset-configurations.md)
0 commit comments