Пример #1
0
        /// <summary>
        /// Reads the version file and adds runtime specific information
        /// </summary>
        public static string ReadAndInterpretVersionFile()
        {
            var content = File.ReadAllText(DotnetFiles.VersionFile);

            content += Environment.NewLine;
            content += RuntimeEnvironment.GetRuntimeIdentifier();
            return(content);
        }
Пример #2
0
 // Gets the identifier that is used for restore by default (this is different from the actual RID, but only on Windows)
 public static string GetLegacyRestoreRuntimeIdentifier()
 {
     if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows)
     {
         return(RuntimeEnvironment.GetRuntimeIdentifier());
     }
     else
     {
         var arch = RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant();
         return("win7-" + arch);
     }
 }
Пример #3
0
 public bool TryGetMostFitRuntimeIdentifier(
     string alternativeCurrentRuntimeIdentifier,
     string[] candidateRuntimeIdentifiers,
     out string mostFitRuntimeIdentifier)
 {
     return(TryGetMostFitRuntimeIdentifier(
                RuntimeEnvironment.GetRuntimeIdentifier(),
                alternativeCurrentRuntimeIdentifier,
                DependencyContext.RuntimeGraph,
                candidateRuntimeIdentifiers,
                out mostFitRuntimeIdentifier));
 }
        public static IEnumerable <string> GetAllCandidateRuntimeIdentifiers(IEnumerable <string> fallbackIdentifiers = null)
        {
            List <string> result = new List <string>();

            if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows)
            {
                result.Add(RuntimeEnvironment.GetRuntimeIdentifier());
            }
            else
            {
                var arch = RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant();
                if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.1", StringComparison.Ordinal))
                {
                    result.Add("win7-" + arch);
                }
                else if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.2", StringComparison.Ordinal))
                {
                    result.Add("win8-" + arch);
                    result.Add("win7-" + arch);
                }
                else if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.3", StringComparison.Ordinal))
                {
                    result.Add("win81-" + arch);
                    result.Add("win8-" + arch);
                    result.Add("win7-" + arch);
                }
                else if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("10.0", StringComparison.Ordinal))
                {
                    result.Add("win10-" + arch);
                    result.Add("win81-" + arch);
                    result.Add("win8-" + arch);
                    result.Add("win7-" + arch);
                }
            }

            if (fallbackIdentifiers != null)
            {
                foreach (string fallbackIdentifier in fallbackIdentifiers)
                {
                    if (!result.Contains(fallbackIdentifier))
                    {
                        result.Add(fallbackIdentifier);
                    }
                }
            }

            return(result);
        }
Пример #5
0
 public bool SupportsCurrentRuntime()
 {
     return(IsRuntimeSupported(RuntimeEnvironment.GetRuntimeIdentifier()));
 }