예제 #1
0
 public static IEnumerable<string> GetAllCandidateRuntimeIdentifiers(this IRuntimeEnvironment env)
 {
     if (env.OperatingSystemPlatform != Platform.Windows)
     {
         yield return env.GetRuntimeIdentifier();
     }
     else
     {
         var arch = env.RuntimeArchitecture.ToLowerInvariant();
         if (env.OperatingSystemVersion.StartsWith("6.1", StringComparison.Ordinal))
         {
             yield return "win7-" + arch;
         }
         else if (env.OperatingSystemVersion.StartsWith("6.2", StringComparison.Ordinal))
         {
             yield return "win8-" + arch;
             yield return "win7-" + arch;
         }
         else if (env.OperatingSystemVersion.StartsWith("6.3", StringComparison.Ordinal))
         {
             yield return "win81-" + arch;
             yield return "win8-" + arch;
             yield return "win7-" + arch;
         }
         else if (env.OperatingSystemVersion.StartsWith("10.0", StringComparison.Ordinal))
         {
             yield return "win10-" + arch;
             yield return "win81-" + arch;
             yield return "win8-" + arch;
             yield return "win7-" + arch;
         }
     }
 }
 // Gets the identfier that is used for restore by default (this is different from the actual RID, but only on Windows)
 public static string GetLegacyRestoreRuntimeIdentifier(this IRuntimeEnvironment env)
 {
     if (env.OperatingSystemPlatform != Platform.Windows)
     {
         return(env.GetRuntimeIdentifier());
     }
     else
     {
         var arch = env.RuntimeArchitecture.ToLowerInvariant();
         return("win7-" + arch);
     }
 }
예제 #3
0
 // Work around NuGet/Home#1941
 public static IEnumerable<string> GetOverrideRestoreRuntimeIdentifiers(this IRuntimeEnvironment env)
 {
     if (env.OperatingSystemPlatform != Platform.Windows)
     {
         yield return env.GetRuntimeIdentifier();
     }
     else
     {
         yield return "win7-x86";
         yield return "win7-x64";
     }
 }
예제 #4
0
        public static string GetFullVersion(this IRuntimeEnvironment env)
        {
            var str = new StringBuilder();

            str.AppendLine($" Version:      {env.RuntimeVersion}");
            str.AppendLine($" Type:         {env.RuntimeType}");
            str.AppendLine($" Architecture: {env.RuntimeArchitecture}");
            str.AppendLine($" OS Name:      {env.OperatingSystem}");

            if (!string.IsNullOrEmpty(env.OperatingSystemVersion))
            {
                str.AppendLine($" OS Version:   {env.OperatingSystemVersion}");
            }

            str.AppendLine($" Runtime Id:   {env.GetRuntimeIdentifier()}");

            return(str.ToString());
        }
예제 #5
0
        public static IEnumerable <string> GetAllRuntimeIdentifiers(this IRuntimeEnvironment env)
        {
            if (!string.Equals(env.OperatingSystem, RuntimeOperatingSystems.Windows, StringComparison.Ordinal))
            {
                yield return(env.GetRuntimeIdentifier());
            }
            else
            {
                var arch = env.RuntimeArchitecture.ToLowerInvariant();
                if (env.OperatingSystemVersion.Equals("7.0", StringComparison.Ordinal))
                {
                    yield return("win7-" + arch);
                }
                else if (env.OperatingSystemVersion.Equals("8.0", StringComparison.Ordinal))
                {
                    yield return("win8-" + arch);

                    yield return("win7-" + arch);
                }
                else if (env.OperatingSystemVersion.Equals("8.1", StringComparison.Ordinal))
                {
                    yield return("win81-" + arch);

                    yield return("win8-" + arch);

                    yield return("win7-" + arch);
                }
                else if (env.OperatingSystemVersion.Equals("10.0", StringComparison.Ordinal))
                {
                    yield return("win10-" + arch);

                    yield return("win81-" + arch);

                    yield return("win8-" + arch);

                    yield return("win7-" + arch);
                }
            }
        }