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
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:
197
197
|------------------------|-----------------|
198
198
|`double Add(double a, double b)`|Add two doubles.|
199
199
|`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.|
210
200
|`int BitwiseOr(int first, int second)`|Perform a bitwise `OR` on the first and second (first | second).|
211
201
|`int BitwiseAnd(int first, int second)`|Perform a bitwise `AND` on the first and second (first & second).|
212
202
|`int BitwiseXor(int first, int second)`|Perform a bitwise `XOR` on the first and second (first ^ second).|
213
203
|`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.|
218
214
|`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. |
220
219
|`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.|
221
227
|`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.|
222
243
|`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.|
225
245
226
246
## Nested property functions
227
247
@@ -417,7 +437,7 @@ The following example shows how this function is used.
417
437
</Project>
418
438
```
419
439
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:
421
441
422
442
```xml
423
443
<Project>
@@ -472,6 +492,7 @@ MSBuild 16.7 and higher define several functions for handling [TargetFramework a
472
492
473
493
|Function signature|Description|
474
494
|------------------------|-----------------|
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`.|
475
496
|`GetTargetFrameworkIdentifier(string targetFramework)`|Parse the TargetFrameworkIdentifier from the TargetFramework.|
476
497
|`GetTargetFrameworkVersion(string targetFramework, int versionPartCount)`|Parse the TargetFrameworkVersion from the TargetFramework.|
477
498
|`GetTargetPlatformIdentifier(string targetFramework)`|Parse the TargetPlatformIdentifier from the TargetFramework.|
0 commit comments