Skip to content

Commit a7e6582

Browse files
committed
Filter target frameworks details
1 parent 5937bb3 commit a7e6582

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/msbuild/property-functions.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Here is a list of MSBuild property functions:
209209
|`bool DoesTaskHostExist(string runtime, string architecture)`|Returns whether a task host is currently installed for the specified runtime and architecture values. See [MSBuild DoesTaskHostExist](#msbuild-doestaskhostexist). |
210210
|`string Escape(string unescaped)`|Escape the string according to MSBuild escaping rules.|
211211
|`string EnsureTrailingSlash(string path)`|If the given path doesn't have a trailing slash then add one. If the path is an empty string, does not modify it. See [MSBuild EnsureTrailingSlash](#msbuild-ensuretrailingslash).|
212-
|`string FilterTargetFrameworks(string incoming, string filter)`|Return the list of the target frameworks that match the specified filter. An target framework from `incoming` is kept if it is compatible with any of the desired target frameworks on `filter`. See [MSBuild TargetFramework and TargetPlatform functions](#msbuild-targetframework-and-targetplatform-functions).|
212+
|`string FilterTargetFrameworks(string incoming, string filter)`|Return the list of the target frameworks that match the specified filter. A target framework from `incoming` is kept if it is compatible with any of the desired target frameworks on `filter`. See [MSBuild TargetFramework and TargetPlatform functions](#msbuild-targetframework-and-targetplatform-functions).|
213213
|`string GetCurrentToolsDirectory()`| Get the current MSBuild tools directory. |
214214
|`string GetMSBuildExtensionsPath()`| Gets the MSBuild extensions path. When running *MSBuild.exe*, this is usually the MSBuild executable folder. When running in Visual Studio, this is the MSBuild subfolder under the Visual Studio installation folder. |
215215
|`string GetMSBuildSDKsPath()` | Gets the directory where SDKs are expected, for the current MSBuild instance.|
@@ -547,6 +547,14 @@ Value6 = False
547547
Value7 = False
548548
```
549549

550+
### MSBuild FilterTargetFrameworks
551+
552+
You can use this property function to select a subset of list of Target Framework Monikers (TFMs), to restrict the list to those frameworks that are compatible with the list of TFMs given the filter argument.
553+
554+
For example, if `incoming` is `net6.0;net7.0;netstandard2.0` and `filter` is `net7.0;netstandard2.0`, the result is `net7.0;netstandard2.0`.
555+
556+
A TFM in the incoming list or in the filter may omit the version, such as `net` or `netstandard`, in which case it matches all versions.
557+
550558
## MSBuild version-comparison functions
551559

552560
MSBuild 16.5 and higher define several functions for comparing strings that represent versions.

0 commit comments

Comments
 (0)