@@ -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
}
@@ -115,11 +115,7 @@ public static bool IsWindowsBrokerSupported()
115
115
/// <returns>True if running on macOS, false otherwise.</returns>
116
116
public static bool IsMacOS ( )
117
117
{
118
- #if NETFRAMEWORK
119
- return Environment . OSVersion . Platform == PlatformID . MacOSX ;
120
- #else
121
118
return RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ;
122
- #endif
123
119
}
124
120
125
121
/// <summary>
@@ -128,11 +124,7 @@ public static bool IsMacOS()
128
124
/// <returns>True if running on Windows, false otherwise.</returns>
129
125
public static bool IsWindows ( )
130
126
{
131
- #if NETFRAMEWORK
132
- return Environment . OSVersion . Platform == PlatformID . Win32NT ;
133
- #else
134
127
return RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ;
135
- #endif
136
128
}
137
129
138
130
/// <summary>
@@ -141,11 +133,7 @@ public static bool IsWindows()
141
133
/// <returns>True if running on a Linux distribution, false otherwise.</returns>
142
134
public static bool IsLinux ( )
143
135
{
144
- #if NETFRAMEWORK
145
- return Environment . OSVersion . Platform == PlatformID . Unix ;
146
- #else
147
136
return RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ;
148
- #endif
149
137
}
150
138
151
139
/// <summary>
@@ -475,9 +463,6 @@ string GetLinuxDistroVersion()
475
463
476
464
private static string GetCpuArchitecture ( )
477
465
{
478
- #if NETFRAMEWORK
479
- return Environment . Is64BitOperatingSystem ? "x86-64" : "x86" ;
480
- #else
481
466
switch ( RuntimeInformation . OSArchitecture )
482
467
{
483
468
case Architecture . Arm :
@@ -491,16 +476,6 @@ private static string GetCpuArchitecture()
491
476
default :
492
477
return RuntimeInformation . OSArchitecture . ToString ( ) ;
493
478
}
494
- #endif
495
- }
496
-
497
- private static string GetClrVersion ( )
498
- {
499
- #if NETFRAMEWORK
500
- return $ ".NET Framework { Environment . Version } ";
501
- #else
502
- return RuntimeInformation . FrameworkDescription ;
503
- #endif
504
479
}
505
480
506
481
#endregion
0 commit comments