Skip to content

Commit 2d5337b

Browse files
committed
Acrolinx
1 parent a53a1c2 commit 2d5337b

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

docs/msbuild/property-functions.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ Property functions are calls to .NET methods that appear in MSBuild property def
1616

1717
Unlike tasks, property functions can be used outside of targets. Property functions are evaluated whenever the properties or items get expanded. So, for properties and items outside of any targets, property functions are evaluated before any target runs. For property groups and item groups inside targets, property functions are evaluated when the target is executed.
1818

19-
Without using MSBuild tasks, you can read the system time, compare strings, match regular expressions, and perform other actions in your build script. MSBuild will try to convert string to number and number to string, and make other conversions as required.
19+
Without using MSBuild tasks, you can read the system time, compare strings, match regular expressions, and perform other actions in your build script. MSBuild tries to convert string to number and number to string, and make other conversions as required.
2020

2121
String values returned from property functions have [special characters](msbuild-special-characters.md) escaped. If you want the value to be treated as though it was put directly in the project file, use `$([MSBuild]::Unescape())` to unescape the special characters.
2222

2323
## Property function syntax
2424

25-
These are three kinds of property functions; each function has a different syntax:
25+
There are three kinds of property functions; each kind has a different syntax:
2626

2727
- String (instance) property functions
2828
- Static property functions
@@ -62,7 +62,7 @@ For example, to set a build property to a new GUID, you can use this script:
6262
<NewGuid>$([System.Guid]::NewGuid())</NewGuid>
6363
```
6464

65-
In static property functions, you can use any public static method or property that's defined in .NET Standard 2.0 for these system classes:
65+
In static property functions, you can use any public static method or property defined in .NET Standard 2.0 for these system classes:
6666

6767
- [System.Byte](/dotnet/api/System.Byte?view=netstandard-2.0&preserve-view=true)
6868
- [System.Char](/dotnet/api/System.Char?view=netstandard-2.0&preserve-view=true)
@@ -94,7 +94,7 @@ In static property functions, you can use any public static method or property t
9494
- [Microsoft.Build.Utilities.ToolLocationHelper](/dotnet/api/Microsoft.Build.Utilities.ToolLocationHelper)
9595

9696
> [!NOTE]
97-
> Methods and properties that aren't defined in .NET Standard 2.0 might be available when you use MSBuild in an environment that supports them, but can't be guaranteed to be available in all situations. For compatibility reasons, they are best avoided.
97+
> Methods and properties that aren't defined in .NET Standard 2.0 might be available when you use MSBuild in an environment that supports them, but can't be guaranteed to be available in all situations. For compatibility reasons, they're best avoided.
9898
9999
In addition, you can use the following static methods and properties:
100100

@@ -137,11 +137,11 @@ In addition, you can use the following static methods and properties:
137137
:::moniker range=">=vs-2022"
138138
#### System.OperatingSystem property functions
139139

140-
The `System.OperatingSystem` property functions return information about the operating system on which MSBuild is running. For example, if your project targets Linux and you build it on macOS, the property functions will return information about macOS.
140+
The `System.OperatingSystem` property functions return information about the operating system on which MSBuild is running. For example, if your project targets Linux and you build it on macOS, the property functions return information about macOS.
141141

142-
In MSBuild running on .NET (`dotnet build`), all static methods of the `System.OperatingSystem` class will be callable as static property functions.
142+
In MSBuild running on .NET (`dotnet build`), all static methods of the `System.OperatingSystem` class are callable as static property functions.
143143

144-
In MSBuild running on .NET Framework (`MSBuild.exe`), only the following methods of `System.OperatingSystem` will be callable as static property functions. MSBuild implements them internally, because `System.OperatingSystem` does not define them on .NET Framework. Methods for operating systems for which there is no .NET SDK, such as `System.OperatingSystem::IsTvOS`, are not callable.
144+
In MSBuild running on .NET Framework (`MSBuild.exe`), only the following methods of `System.OperatingSystem` are callable as static property functions. MSBuild implements them internally, because `System.OperatingSystem` does not define them on .NET Framework. Methods for operating systems for which there's no .NET SDK, such as `System.OperatingSystem::IsTvOS`, are not callable.
145145

146146
- [System.OperatingSystem::IsOSPlatform](/dotnet/api/System.OperatingSystem.IsOSPlatform)
147147
- [System.OperatingSystem::IsOSPlatformVersionAtLeast](/dotnet/api/System.OperatingSystem.IsOSPlatformVersionAtLeast)
@@ -191,7 +191,7 @@ For example, to add together two properties that have numeric values, use the fo
191191
$([MSBuild]::Add($(NumberOne), $(NumberTwo)))
192192
```
193193

194-
Here is a list of MSBuild property functions:
194+
Here's a list of MSBuild property functions:
195195

196196
:::moniker range=">=vs-2022"
197197
|Function signature|Description|
@@ -231,7 +231,7 @@ Here is a list of MSBuild property functions:
231231
|`bool IsOSUnixLike()`|True if current OS is a Unix system.|
232232
|`bool IsTargetFrameworkCompatible(string targetFrameworkTarget, string targetFrameworkCandidate)`|Return 'True' if the candidate target framework (second argument) is compatible with the target framework indicated by the first argument, and false otherwise. See [MSBuild TargetFramework and TargetPlatform functions](#msbuild-targetframework-and-targetplatform-functions).|
233233
|`int LeftShift(int operand, int count)`| Shift left by `count` bits. MSBuild 17.7 and later. |
234-
|`string MakeRelative(string basePath, string path)`|Makes `path` relative to `basePath`. `basePath` must be an absolute directory. If `path` cannot be made relative, it is returned verbatim. Similar to `Uri.MakeRelativeUri`. See [MSBuild MakeRelative](#msbuild-makerelative).|
234+
|`string MakeRelative(string basePath, string path)`|Makes `path` relative to `basePath`. `basePath` must be an absolute directory. If `path` can't be made relative, it is returned verbatim. Similar to `Uri.MakeRelativeUri`. See [MSBuild MakeRelative](#msbuild-makerelative).|
235235
|`double Modulo(double a, double b)`|Modulo two doubles.|
236236
|`long Modulo(long a, long b)`|Modulo two longs.|
237237
|`double Multiply(double a, double b)`|Multiply two doubles.|
@@ -365,7 +365,7 @@ This example shows how to import the nearest *EnlistmentInfo.props* file in or a
365365
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), EnlistmentInfo.props))\EnlistmentInfo.props" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), EnlistmentInfo.props))' != '' " />
366366
```
367367

368-
Note that this example can be written more concisely by using the `GetPathOfFileAbove` function instead:
368+
This example can be written more concisely by using the `GetPathOfFileAbove` function instead:
369369

370370
```xml
371371
<Import Project="$([MSBuild]::GetPathOfFileAbove(EnlistmentInfo.props))" Condition=" '$([MSBuild]::GetPathOfFileAbove(EnlistmentInfo.props))' != '' " />
@@ -381,7 +381,7 @@ This property function has the following syntax:
381381
$([MSBuild]::GetPathOfFileAbove(string file, [string startingDirectory]))
382382
```
383383

384-
where `file` is the name of the file to search for and `startingDirectory` is an optional directory to start the search in. By default, the search will start in the current file's own directory.
384+
where `file` is the name of the file to search for and `startingDirectory` is an optional directory to start the search in. By default, the search starts in the current file's own directory.
385385

386386
This example shows how to import a file named *dir.props* in or above the current directory, only if a match is found:
387387

@@ -450,7 +450,7 @@ The following is an example.
450450
$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Silverlight\v3.0\ReferenceAssemblies', 'SLRuntimeInstallPath', null, RegistryView.Registry64, RegistryView.Registry32))
451451
```
452452

453-
gets the **SLRuntimeInstallPath** data of the **ReferenceAssemblies** key, looking first in the 64-bit registry view and then in the 32-bit registry view.
453+
The preceding code gets the **SLRuntimeInstallPath** data of the **ReferenceAssemblies** key, looking first in the 64-bit registry view and then in the 32-bit registry view.
454454

455455
> [!WARNING]
456456
> In the .NET SDK version of MSBuild (`dotnet build`), this function is not supported.
@@ -562,23 +562,23 @@ MSBuild 16.7 and higher define several functions for handling [TargetFramework a
562562

563563
|Function signature|Description|
564564
|------------------------|-----------------|
565-
|`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 matches any of the desired target frameworks on `filter`.|
566-
|`GetTargetFrameworkIdentifier(string targetFramework)`|Parse the TargetFrameworkIdentifier from the TargetFramework.|
567-
|`GetTargetFrameworkVersion(string targetFramework, int versionPartCount)`|Parse the TargetFrameworkVersion from the TargetFramework.|
568-
|`GetTargetPlatformIdentifier(string targetFramework)`|Parse the TargetPlatformIdentifier from the TargetFramework.|
569-
|`GetTargetPlatformVersion(string targetFramework, int versionPartCount)`|Parse the TargetPlatformVersion from the TargetFramework.|
570-
|`IsTargetFrameworkCompatible(string targetFrameworkTarget, string targetFrameworkCandidate)`|Return 'True' if the candidate target framework (second argument) is compatible with the target framework indicated by the first argument, and false otherwise.|
565+
| `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 matches any of the desired target frameworks on `filter`. |
566+
| `GetTargetFrameworkIdentifier(string targetFramework)` | Parse the TargetFrameworkIdentifier from the TargetFramework. |
567+
| `GetTargetFrameworkVersion(string targetFramework, int versionPartCount)`| Parse the TargetFrameworkVersion from the TargetFramework. |
568+
|`GetTargetPlatformIdentifier(string targetFramework)` | Parse the TargetPlatformIdentifier from the TargetFramework. |
569+
| `GetTargetPlatformVersion(string targetFramework, int versionPartCount)` | Parse the TargetPlatformVersion from the TargetFramework. |
570+
| `IsTargetFrameworkCompatible(string targetFrameworkTarget, string targetFrameworkCandidate)` | Return true if the candidate target framework (second argument) is compatible with the target framework indicated by the first argument, and false otherwise.|
571571
:::moniker-end
572572

573573
:::moniker range="<=vs-2019"
574574

575575
|Function signature|Description|
576576
|------------------------|-----------------|
577-
|`GetTargetFrameworkIdentifier(string targetFramework)`|Parse the TargetFrameworkIdentifier from the TargetFramework.|
578-
|`GetTargetFrameworkVersion(string targetFramework, int versionPartCount)`|Parse the TargetFrameworkVersion from the TargetFramework.|
579-
|`GetTargetPlatformIdentifier(string targetFramework)`|Parse the TargetPlatformIdentifier from the TargetFramework.|
580-
|`GetTargetPlatformVersion(string targetFramework, int versionPartCount)`|Parse the TargetPlatformVersion from the TargetFramework.|
581-
|`IsTargetFrameworkCompatible(string targetFrameworkTarget, string targetFrameworkCandidate)`|Return 'True' if the candidate target framework (second argument) is compatible with the target framework indicated by the first argument, and false otherwise.|
577+
| `GetTargetFrameworkIdentifier(string targetFramework)` | Parse the TargetFrameworkIdentifier from the TargetFramework.|
578+
| `GetTargetFrameworkVersion(string targetFramework, int versionPartCount)` | Parse the TargetFrameworkVersion from the TargetFramework. |
579+
| `GetTargetPlatformIdentifier(string targetFramework)` | Parse the TargetPlatformIdentifier from the TargetFramework.|
580+
| `GetTargetPlatformVersion(string targetFramework, int versionPartCount)` | Parse the TargetPlatformVersion from the TargetFramework. |
581+
| `IsTargetFrameworkCompatible(string targetFrameworkTarget, string targetFrameworkCandidate)` | Return true if the candidate target framework (second argument) is compatible with the target framework indicated by the first argument, and false otherwise. |
582582
:::moniker-end
583583

584584
The `versionPartCount` parameter of `GetTargetFrameworkVersion` and `GetTargetPlatformVersion` has a default value of 2.
@@ -665,7 +665,7 @@ In these methods, versions are parsed like <xref:System.Version?displayProperty=
665665
666666
## MSBuild condition functions
667667

668-
The functions `Exists` and `HasTrailingSlash` are not property functions. They are available for use with the `Condition` attribute. See [MSBuild conditions](msbuild-conditions.md).
668+
The functions `Exists` and `HasTrailingSlash` are not property functions. They're available for use with the `Condition` attribute. See [MSBuild conditions](msbuild-conditions.md).
669669

670670
## Related content
671671

0 commit comments

Comments
 (0)