@@ -25,92 +25,6 @@ internal static class RuntimeEnvironment
2525 public static string OperatingSystemVersion { get ; } = GetOSVersion ( ) ;
2626 public static string OperatingSystem { get ; } = GetOSName ( ) ;
2727
28- // toolset-tasks.csproj needs to build for full .NET Framework, and needs to get the current
29- // RuntimeIdentifier of the machine. Because of this, it needs to implement
30- // it's own GetRuntimeIdentifier(). All other places should use RuntimeInformation.RuntimeIdentifier.
31- #if TOOLSET_TASKS
32- private static readonly string OverrideEnvironmentVariableName = "DOTNET_RUNTIME_ID" ;
33-
34- public static string GetRuntimeIdentifier ( )
35- {
36- return
37- Environment . GetEnvironmentVariable ( OverrideEnvironmentVariableName ) ??
38- ( GetRIDOS ( ) + GetRIDVersion ( ) + GetRIDArch ( ) ) ;
39- }
40-
41- private static string GetRIDArch ( )
42- {
43- return $ "-{ RuntimeInformation . ProcessArchitecture . ToString ( ) . ToLowerInvariant ( ) } ";
44- }
45-
46- private static string GetRIDVersion ( )
47- {
48- // Windows RIDs do not separate OS name and version by "." due to legacy
49- // Others do, that's why we have the "." prefix on them below
50- switch ( OperatingSystemPlatform )
51- {
52- case Platform . Windows :
53- return GetWindowsProductVersion ( ) ;
54- case Platform . Linux :
55- if ( string . IsNullOrEmpty ( OperatingSystemVersion ) )
56- {
57- return string . Empty ;
58- }
59-
60- return $ ".{ OperatingSystemVersion } ";
61- case Platform . Darwin :
62- return $ ".{ OperatingSystemVersion } ";
63- case Platform . FreeBSD :
64- return $ ".{ OperatingSystemVersion } ";
65- default :
66- return string . Empty ; // Unknown Platform? Unknown Version!
67- }
68- }
69-
70- private static string GetWindowsProductVersion ( )
71- {
72- var ver = Version . Parse ( OperatingSystemVersion ) ;
73- if ( ver . Major == 6 )
74- {
75- if ( ver . Minor == 1 )
76- {
77- return "7" ;
78- }
79- else if ( ver . Minor == 2 )
80- {
81- return "8" ;
82- }
83- else if ( ver . Minor == 3 )
84- {
85- return "81" ;
86- }
87- }
88- else if ( ver . Major >= 10 )
89- {
90- // Return the major version for use in RID computation without applying any cap.
91- return ver . Major . ToString ( ) ;
92- }
93- return string . Empty ; // Unknown version
94- }
95-
96- private static string GetRIDOS ( )
97- {
98- switch ( OperatingSystemPlatform )
99- {
100- case Platform . Windows :
101- return "win" ;
102- case Platform . Linux :
103- return OperatingSystem . ToLowerInvariant ( ) ;
104- case Platform . Darwin :
105- return "osx" ;
106- case Platform . FreeBSD :
107- return "freebsd" ;
108- default :
109- return "unknown" ;
110- }
111- }
112- #endif // TOOLSET_TASKS
113-
11428 private class DistroInfo
11529 {
11630 public string Id ;
@@ -372,6 +286,5 @@ internal static string RtlGetVersion()
372286 }
373287 }
374288 }
375-
376289 }
377290}
0 commit comments