@@ -19,7 +19,7 @@ public static PlatformInformation GetPlatformInformation(ITrace2 trace2)
19
19
string osType = GetOSType ( ) ;
20
20
string osVersion = GetOSVersion ( trace2 ) ;
21
21
string cpuArch = GetCpuArchitecture ( ) ;
22
- string clrVersion = GetClrVersion ( ) ;
22
+ string clrVersion = RuntimeInformation . FrameworkDescription ;
23
23
24
24
return new PlatformInformation ( osType , osVersion , cpuArch , clrVersion ) ;
25
25
}
@@ -99,11 +99,7 @@ public static bool IsWindowsBrokerSupported()
99
99
/// <returns>True if running on macOS, false otherwise.</returns>
100
100
public static bool IsMacOS ( )
101
101
{
102
- #if NETFRAMEWORK
103
- return Environment . OSVersion . Platform == PlatformID . MacOSX ;
104
- #else
105
102
return RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ;
106
- #endif
107
103
}
108
104
109
105
/// <summary>
@@ -112,11 +108,7 @@ public static bool IsMacOS()
112
108
/// <returns>True if running on Windows, false otherwise.</returns>
113
109
public static bool IsWindows ( )
114
110
{
115
- #if NETFRAMEWORK
116
- return Environment . OSVersion . Platform == PlatformID . Win32NT ;
117
- #else
118
111
return RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ;
119
- #endif
120
112
}
121
113
122
114
/// <summary>
@@ -125,11 +117,7 @@ public static bool IsWindows()
125
117
/// <returns>True if running on a Linux distribution, false otherwise.</returns>
126
118
public static bool IsLinux ( )
127
119
{
128
- #if NETFRAMEWORK
129
- return Environment . OSVersion . Platform == PlatformID . Unix ;
130
- #else
131
120
return RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ;
132
- #endif
133
121
}
134
122
135
123
/// <summary>
@@ -459,9 +447,6 @@ string GetLinuxDistroVersion()
459
447
460
448
private static string GetCpuArchitecture ( )
461
449
{
462
- #if NETFRAMEWORK
463
- return Environment . Is64BitOperatingSystem ? "x86-64" : "x86" ;
464
- #else
465
450
switch ( RuntimeInformation . OSArchitecture )
466
451
{
467
452
case Architecture . Arm :
@@ -475,16 +460,6 @@ private static string GetCpuArchitecture()
475
460
default :
476
461
return RuntimeInformation . OSArchitecture . ToString ( ) ;
477
462
}
478
- #endif
479
- }
480
-
481
- private static string GetClrVersion ( )
482
- {
483
- #if NETFRAMEWORK
484
- return $ ".NET Framework { Environment . Version } ";
485
- #else
486
- return RuntimeInformation . FrameworkDescription ;
487
- #endif
488
463
}
489
464
490
465
#endregion
0 commit comments