Прочетете на английски

Споделяне чрез


Toolset Class

Definition

Aggregation of a toolset version (eg. "2.0"), tools path, and optional set of associated properties. Toolset is immutable.

C#
public class Toolset
Inheritance
Toolset

Remarks

UNDONE: Review immutability. If this is not immutable, add a mechanism to notify the project collection/s owning it to increment their toolsetVersion.

Constructors

Toolset(String, String, IDictionary<String,String>, ProjectCollection, IDictionary<String,SubToolset>, String)

Constructor that also associates a set of properties with the tools version

Toolset(String, String, IDictionary<String,String>, ProjectCollection, String)

Constructor that also associates a set of properties with the tools version

Toolset(String, String, ProjectCollection, String)

Constructor taking only tools version and a matching tools path

Properties

DefaultSubToolsetVersion

Returns the default sub-toolset version for this sub-toolset. Heuristic used is:

  1. If Visual Studio 2010 is installed and our ToolsVersion is "4.0", use the base toolset, and return a sub-toolset version of "10.0", to be set as a publicly visible property so that e.g. targets can consume it. This is to handle the fact that Visual Studio 2010 did not have any concept of sub-toolsets.
  2. Otherwise, use the highest-versioned sub-toolset found. Sub-toolsets with numbered versions will be ordered numerically; any additional sub-toolsets will be prepended to the beginning of the list in the order found. We use the highest-versioned sub-toolset because, in the absence of any other information, we assume that higher-versioned tools will be more likely to be able to generate something more correct.

Will return null if there is no sub-toolset available (and Dev10 is not installed).

Properties

Properties associated with the toolset

SubToolsets

The set of sub-toolsets associated with this toolset.

ToolsPath

Path to this toolset's tasks and targets. Corresponds to $(MSBuildToolsPath) in a project or targets file.

ToolsVersion

Name of this toolset

Methods

GenerateSubToolsetVersion()

Generates the sub-toolset version to be used with this toolset. Sub-toolset version is based on:

  1. If "VisualStudioVersion" is set as a property on the toolset itself (global or environment), use that.
  2. Otherwise, use the default sub-toolset version for this toolset.

The sub-toolset version returned may be null; if so, that means that no sub-toolset should be used, just the base toolset on its own. The sub-toolset version returned may not map to an existing sub-toolset.

GenerateSubToolsetVersion(IDictionary<String,String>, Int32)

Generates the sub-toolset version to be used with this toolset. Sub-toolset version is based on:

  1. If the "VisualStudioVersion" global property exists in the set of properties passed to us, use it.
  2. Otherwise, if "VisualStudioVersion" is set as a property on the toolset itself (global or environment), use that.
  3. Otherwise, use Visual Studio version from solution file if it maps to an existing sub-toolset.
  4. Otherwise, use the default sub-toolset version for this toolset.

The sub-toolset version returned may be null; if so, that means that no sub-toolset should be used, just the base toolset on its own. The sub-toolset version returned may not map to an existing sub-toolset.

The global properties dictionary may be null.

GetProperty(String, String)

Given a property name and a sub-toolset version, searches for that property first in the sub-toolset, then falls back to the base toolset if necessary, and returns the property if it was found.

Applies to

Продукт Версии
MSBuild 15, 16, 17
MSBuild (.NET Core) 15, 16, 17