Skip to content

Commit f1bbea5

Browse files
committed
Add missing property functions
1 parent 62c5401 commit f1bbea5

File tree

1 file changed

+40
-19
lines changed

1 file changed

+40
-19
lines changed

docs/msbuild/property-functions.md

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ In addition, you can use the following static methods and properties:
134134
- [System.Globalization.CultureInfo::new](/dotnet/api/System.Globalization.CultureInfo.-ctor?view=netstandard-2.0&preserve-view=true)
135135
- [System.Globalization.CultureInfo::CurrentUICulture](/dotnet/api/System.Globalization.CultureInfo.CurrentUICulture?view=netstandard-2.0&preserve-view=true)
136136

137-
:::moniker range="vs-2022"
137+
:::moniker range=">=vs-2022"
138138
#### System.OperatingSystem property functions
139139

140140
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.
@@ -197,31 +197,51 @@ Here is a list of MSBuild property functions:
197197
|------------------------|-----------------|
198198
|`double Add(double a, double b)`|Add two doubles.|
199199
|`long Add(long a, long b)`|Add two longs.|
200-
|`double Subtract(double a, double b)`|Subtract two doubles.|
201-
|`long Subtract(long a, long b)`|Subtract two longs.|
202-
|`double Multiply(double a, double b)`|Multiply two doubles.|
203-
|`long Multiply(long a, long b)`|Multiply two longs.|
204-
|`double Divide(double a, double b)`|Divide two doubles.|
205-
|`long Divide(long a, long b)`|Divide two longs.|
206-
|`double Modulo(double a, double b)`|Modulo two doubles.|
207-
|`long Modulo(long a, long b)`|Modulo two longs.|
208-
|`string Escape(string unescaped)`|Escape the string according to MSBuild escaping rules.|
209-
|`string Unescape(string escaped)`|Unescape the string according to MSBuild escaping rules.|
210200
|`int BitwiseOr(int first, int second)`|Perform a bitwise `OR` on the first and second (first | second).|
211201
|`int BitwiseAnd(int first, int second)`|Perform a bitwise `AND` on the first and second (first & second).|
212202
|`int BitwiseXor(int first, int second)`|Perform a bitwise `XOR` on the first and second (first ^ second).|
213203
|`int BitwiseNot(int first)`|Perform a bitwise `NOT` (~first).|
214-
|`bool IsOsPlatform(string platformString)`|Specify whether the current OS platform is `platformString`. `platformString` must be a member of <xref:System.Runtime.InteropServices.OSPlatform>.|
215-
|`bool IsOSUnixLike()`|True if current OS is a Unix system.|
216-
|`string NormalizePath(params string[] path)`|Gets the canonicalized full path of the provided path and ensures it contains the correct directory separator characters for the current operating system.|
217-
|`string NormalizeDirectory(params string[] path)`|Gets the canonicalized full path of the provided directory and ensures it contains the correct directory separator characters for the current operating system while ensuring it has a trailing slash.|
204+
|`string CheckFeatureAvailability(string featureName)`| Returns the feature name as a string if and only if the specified feature is supported in this version of MSBuild. |
205+
|`string ConvertToBase64(string toEncode)`|Returns the string after converting all bytes to base 64 (alphanumeric characters plus `+` and `/`), ending in one or two `=`.|
206+
|`string ConvertFromBase64(string toDecode)`|Returns the string after converting from base 64 (alphanumeric characters plus `+` and `/`), ending in one or two `=`.|
207+
|`string CurrentMSBuildConfigurationFile()`|Gets the path to the configuration file used by this instance of MSBuild.|
208+
|`string CurrentMSBuildExePath()` |Gets the path to the executable file for this instance of MSBuild. This path might not be the current running process. For example, if running inside Visual Studio or another host process, the returned path will point to the version of MSBuild found to be associated with the current environment.|
209+
|`string CurrentMSBuildToolsDirectory()`| Gets the full path to the MSBuild tools directory for the current instance of MSBuild. |
210+
|`double Divide(double a, double b)`|Divide two doubles.|
211+
|`long Divide(long a, long b)`|Divide two longs.|
212+
|`bool DoesTaskHostExist(string runtime, string architecture)`|Returns whether a task host is currently installed for the specified runtime and architecture values.|
213+
|`string Escape(string unescaped)`|Escape the string according to MSBuild escaping rules.|
218214
|`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.|
219-
|`string GetPathOfFileAbove(string file, string startingDirectory)`|Searches for and returns the full path to a file in the directory structure at and above the current build file's location, or based on `startingDirectory`, if specified.|
215+
|`string GetCurrentToolsDirectory()`| Get the current MSBuild tools directory. |
216+
|`string GetToolsDirectory32()` | Gets the directory where Arm64 versions of the MSBuild tools are located. |
217+
|`string GetToolsDirectory32()` | Gets the directory where 32-bit versions of the MSBuild tools are located. |
218+
|`string GetToolsDirectory64()` | Gets the directory where 64-bit versions of the MSBuild tools are located. |
220219
|`string GetDirectoryNameOfFileAbove(string startingDirectory, string fileName)`|Locate and return the directory of a file in either the directory specified or a location in the directory structure above that directory.|
220+
|`string GetPathOfFileAbove(string file, string startingDirectory)`|Searches for and returns the full path to a file in the directory structure at and above the current build file's location, or based on `startingDirectory`, if specified.|
221+
|`object GetRegistryValue(string keyName, string valueName, object defaultValue)`|Get the value of the registry key and value.|
222+
|`object GetRegistryValueFromView(string keyName, string valueName, object defaultValue, params object[] views)`|Gets system registry data given the registry key, value, and one or more ordered registry views.|
223+
|`bool IsOsPlatform(string platformString)`|Specify whether the current OS platform is `platformString`. `platformString` must be a member of <xref:System.Runtime.InteropServices.OSPlatform>.|
224+
|`bool IsOsBsdLike()`|True if the current OS is a BSD-style Unix system.|
225+
|`bool IsOSUnixLike()`|True if current OS is a Unix system.|
226+
|`int LeftShift(int operand, int count)`| Shift left by `count` bits.|
221227
|`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`.|
228+
|`double Modulo(double a, double b)`|Modulo two doubles.|
229+
|`long Modulo(long a, long b)`|Modulo two longs.|
230+
|`string MSBuildExtensionsPath()`| 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. |
231+
|`string MSBuildSDKsPath()` | Gets the directory where SDKs are expected, for the current MSBuild instance.|
232+
|`double Multiply(double a, double b)`|Multiply two doubles.|
233+
|`long Multiply(long a, long b)`|Multiply two longs.|
234+
|`string NormalizeDirectory(params string[] path)`|Gets the canonicalized full path of the provided directory and ensures it contains the correct directory separator characters for the current operating system while ensuring it has a trailing slash.|
235+
|`string NormalizePath(params string[] path)`|Gets the canonicalized full path of the provided path and ensures it contains the correct directory separator characters for the current operating system.|
236+
|`int RightShift(int operand, int count)`| Shift right by `count` bits, as a signed integer. |
237+
|`int RightShiftUnsigned(int operand, int count)`| Shift right by `count` bits, treating the operand as an unsigned integer.|
238+
|`object StableStringHash(string toHash, StringHashingAlgorithm algo)`| Accepts a string argument, and returns a hash code that is guaranteed to be stable.|
239+
|`string SubstringByAsciiChars(string input, int start, int length)`|Returns a substring of `input`, starting at the specified `start` position and with the specified `length`, treating the string as ASCII-encoded.|
240+
|`double Subtract(double a, double b)`|Subtract two doubles.|
241+
|`long Subtract(long a, long b)`|Subtract two longs.|
242+
|`string Unescape(string escaped)`|Unescape the string according to MSBuild escaping rules.|
222243
|`string ValueOrDefault(string conditionValue, string defaultValue)`|Returns the string in parameter `defaultValue` only if parameter `conditionValue` is empty, else, return the value `conditionValue`.|
223-
|`string ConvertToBase64(string toEncode)`|Returns the string after converting all bytes to base 64 (alphanumeric characters plus `+` and `/`), ending in one or two `=`.|
224-
|`string ConvertFromBase64(string toDecode)`|Returns the string after converting from base 64 (alphanumeric characters plus `+` and `/`), ending in one or two `=`.|
244+
|`string VisualStudioInstallRootDirectory()`|Gets the full path to the root of the Visual Studio installation folder associated with the current instance of MSBuild.|
225245

226246
## Nested property functions
227247

@@ -417,7 +437,7 @@ The following example shows how this function is used.
417437
</Project>
418438
```
419439

420-
From MSBuild version 17.10.0 this function accepts second, optional, argument requesting the hashing algorithm to be used:
440+
With MSBuild version 17.10 and later, this function accepts second, optional, argument requesting the hashing algorithm to be used:
421441

422442
```xml
423443
<Project>
@@ -472,6 +492,7 @@ MSBuild 16.7 and higher define several functions for handling [TargetFramework a
472492

473493
|Function signature|Description|
474494
|------------------------|-----------------|
495+
|`FilterTargetFrameworks(string incoming, string filter)`|Return the list of the target frameworks that match the specified filter. An incoming target framework from `incoming` is kept if it is compatible with any of the desired target frameworks on `filter`.|
475496
|`GetTargetFrameworkIdentifier(string targetFramework)`|Parse the TargetFrameworkIdentifier from the TargetFramework.|
476497
|`GetTargetFrameworkVersion(string targetFramework, int versionPartCount)`|Parse the TargetFrameworkVersion from the TargetFramework.|
477498
|`GetTargetPlatformIdentifier(string targetFramework)`|Parse the TargetPlatformIdentifier from the TargetFramework.|

0 commit comments

Comments
 (0)