@@ -31,7 +31,6 @@ public static bool IsDevBox()
3131 return false ;
3232 }
3333
34- #if NETFRAMEWORK
3534 // Check for machine (HKLM) registry keys for Cloud PC indicators
3635 // Note that the keys are only found in the 64-bit registry view
3736 using ( Microsoft . Win32 . RegistryKey hklm64 = Microsoft . Win32 . RegistryKey . OpenBaseKey ( Microsoft . Win32 . RegistryHive . LocalMachine , Microsoft . Win32 . RegistryView . Registry64 ) )
@@ -48,9 +47,6 @@ public static bool IsDevBox()
4847
4948 return w365Value is not null && Guid . TryParse ( partnerValue , out Guid partnerId ) && partnerId == Constants . DevBoxPartnerId ;
5049 }
51- #else
52- return false ;
53- #endif
5450 }
5551
5652 public static bool IsWindowsBrokerSupported ( )
@@ -99,11 +95,7 @@ public static bool IsWindowsBrokerSupported()
9995 /// <returns>True if running on macOS, false otherwise.</returns>
10096 public static bool IsMacOS ( )
10197 {
102- #if NETFRAMEWORK
103- return Environment . OSVersion . Platform == PlatformID . MacOSX ;
104- #else
10598 return RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ;
106- #endif
10799 }
108100
109101 /// <summary>
@@ -112,11 +104,7 @@ public static bool IsMacOS()
112104 /// <returns>True if running on Windows, false otherwise.</returns>
113105 public static bool IsWindows ( )
114106 {
115- #if NETFRAMEWORK
116- return Environment . OSVersion . Platform == PlatformID . Win32NT ;
117- #else
118107 return RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ;
119- #endif
120108 }
121109
122110 /// <summary>
@@ -125,11 +113,7 @@ public static bool IsWindows()
125113 /// <returns>True if running on a Linux distribution, false otherwise.</returns>
126114 public static bool IsLinux ( )
127115 {
128- #if NETFRAMEWORK
129- return Environment . OSVersion . Platform == PlatformID . Unix ;
130- #else
131116 return RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ;
132- #endif
133117 }
134118
135119 /// <summary>
@@ -193,11 +177,9 @@ public static bool IsElevatedUser()
193177 {
194178 if ( IsWindows ( ) )
195179 {
196- #if NETFRAMEWORK
197180 var identity = System . Security . Principal . WindowsIdentity . GetCurrent ( ) ;
198181 var principal = new System . Security . Principal . WindowsPrincipal ( identity ) ;
199182 return principal . IsInRole ( System . Security . Principal . WindowsBuiltInRole . Administrator ) ;
200- #endif
201183 }
202184 else if ( IsPosix ( ) )
203185 {
@@ -283,9 +265,6 @@ private static string GetLinuxEntryPath()
283265 }
284266 }
285267
286- #if NETFRAMEWORK
287- return null ;
288- #else
289268 //
290269 // We cannot determine the absolute file path from argv[0]
291270 // (how we were launched), so let's now try to extract the
@@ -295,7 +274,6 @@ private static string GetLinuxEntryPath()
295274 //
296275 FileSystemInfo fsi = File . ResolveLinkTarget ( "/proc/self/exe" , returnFinalTarget : false ) ;
297276 return fsi ? . FullName ;
298- #endif
299277 }
300278
301279 private static string GetMacOSEntryPath ( )
@@ -364,12 +342,11 @@ private static string GetOSVersion(ITrace2 trace2)
364342 // However, we still need to use the old method for Windows on .NET Framework
365343 // and call into the Win32 API to get the correct version (regardless of app
366344 // compatibility settings).
367- #if NETFRAMEWORK
368345 if ( IsWindows ( ) && RtlGetVersionEx ( out RTL_OSVERSIONINFOEX osvi ) == 0 )
369346 {
370347 return $ "{ osvi . dwMajorVersion } .{ osvi . dwMinorVersion } (build { osvi . dwBuildNumber } )";
371348 }
372- #endif
349+
373350 if ( IsWindows ( ) || IsMacOS ( ) )
374351 {
375352 return Environment . OSVersion . Version . ToString ( ) ;
@@ -459,9 +436,6 @@ string GetLinuxDistroVersion()
459436
460437 private static string GetCpuArchitecture ( )
461438 {
462- #if NETFRAMEWORK
463- return Environment . Is64BitOperatingSystem ? "x86-64" : "x86" ;
464- #else
465439 switch ( RuntimeInformation . OSArchitecture )
466440 {
467441 case Architecture . Arm :
@@ -475,16 +449,11 @@ private static string GetCpuArchitecture()
475449 default :
476450 return RuntimeInformation . OSArchitecture . ToString ( ) ;
477451 }
478- #endif
479452 }
480453
481454 private static string GetClrVersion ( )
482455 {
483- #if NETFRAMEWORK
484- return $ ".NET Framework { Environment . Version } ";
485- #else
486456 return RuntimeInformation . FrameworkDescription ;
487- #endif
488457 }
489458
490459 #endregion
0 commit comments