diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 04ef3fe734c9..b82298cb7a7c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -13,9 +13,9 @@ https://github.com/dotnet/runtime 6e83eafe49ce3c55e9f68ae669f24957e5b482f8 - - https://github.com/dotnet/runtime - 6e83eafe49ce3c55e9f68ae669f24957e5b482f8 + + https://github.com/dotnet/arcade + bce0a98620c1c5a110b2bba9912f3d5929069c6b https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index a8bc08afeca0..a0aaff0eea7f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -18,7 +18,6 @@ 2.1.0-preview2-26306-03 2.0.0 2.0.1-servicing-26011-01 - 2.0.0 11.0.1 $(NewtonsoftJsonPackageVersion) 4.0.0 @@ -30,11 +29,9 @@ 5.0.0-preview.4.20213.12 5.0.0-preview.4.20213.12 $(MicrosoftNETCoreAppRuntimewinx64PackageVersion) - 5.0.0-preview.4.20213.12 5.0.0-preview.4.20202.18 5.0.0-preview.4.20213.12 5.0.0-preview.4.20213.12 - $(MicrosoftDotNetPlatformAbstractionsPackageVersion) $(MicrosoftExtensionsDependencyModelPackageVersion) @@ -133,6 +130,7 @@ 4.19.2 4.19.0 + 5.0.0-beta.20201.2 .exe diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/Constants.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/Constants.cs index 20a8cba23ef4..71edc1dc274d 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/Constants.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/Constants.cs @@ -1,18 +1,18 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Microsoft.DotNet.PlatformAbstractions; +using System.Runtime.InteropServices; namespace Microsoft.DotNet.Cli.Utils { public static class Constants { - private static Platform CurrentPlatform => RuntimeEnvironment.OperatingSystemPlatform; public const string DefaultConfiguration = "Debug"; public static readonly string ProjectFileName = "project.json"; public static readonly string DotConfigDirectoryName = ".config"; - public static readonly string ExeSuffix = CurrentPlatform == Platform.Windows ? ".exe" : string.Empty; + public static readonly string ExeSuffix = + RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty; public static readonly string BinDirectoryName = "bin"; public static readonly string ObjDirectoryName = "obj"; diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/DangerousFileDetector.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/DangerousFileDetector.cs index 3dbc53af92a7..9c8925a8c06e 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/DangerousFileDetector.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/DangerousFileDetector.cs @@ -4,8 +4,6 @@ using System; using System.IO; using System.Runtime.InteropServices; -using Microsoft.DotNet.PlatformAbstractions; -using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment; namespace Microsoft.DotNet.Cli.Utils { @@ -13,7 +11,7 @@ internal class DangerousFileDetector : IDangerousFileDetector { public bool IsDangerous(string filePath) { - if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows) + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return false; } diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs index 9e6a39533904..462107f00648 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs @@ -5,7 +5,6 @@ using System.IO; using System.Reflection; using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.PlatformAbstractions; namespace Microsoft.DotNet.Cli { diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetVersionFile.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetVersionFile.cs index 1f76067f2f1c..7c95e6665142 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetVersionFile.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetVersionFile.cs @@ -18,9 +18,9 @@ internal class DotnetVersionFile /// The runtime identifier (rid) that this CLI was built for. /// /// - /// This is different than RuntimeEnvironment.GetRuntimeIdentifier() because the + /// This is different than RuntimeInformation.RuntimeIdentifier because the /// BuildRid is a RID that is guaranteed to exist and works on the current machine. The - /// RuntimeEnvironment.GetRuntimeIdentifier() may be for a new version of the OS that + /// RuntimeInformation.RuntimeIdentifier may be for a new version of the OS that /// doesn't have full support yet. /// public string BuildRid { get; set; } diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/EnvironmentProvider.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/EnvironmentProvider.cs index f0a9fefbe982..22365f3e99cd 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/EnvironmentProvider.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/EnvironmentProvider.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.DotNet.PlatformAbstractions; +using System.Runtime.InteropServices; namespace Microsoft.DotNet.Cli.Utils { @@ -24,7 +24,7 @@ public IEnumerable ExecutableExtensions if (_executableExtensions == null) { - _executableExtensions = RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows + _executableExtensions = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Environment.GetEnvironmentVariable("PATHEXT") .Split(';') .Select(e => e.ToLower().Trim('"')) @@ -41,7 +41,7 @@ private IEnumerable SearchPaths { if (_searchPaths == null) { - var searchPaths = new List { ApplicationEnvironment.ApplicationBasePath }; + var searchPaths = new List { AppContext.BaseDirectory }; searchPaths.AddRange(Environment .GetEnvironmentVariable("PATH") diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs index 48c149c740db..80ed0672f22c 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; -using Microsoft.DotNet.PlatformAbstractions; +using System.Runtime.InteropServices; namespace Microsoft.DotNet.Cli.Utils { @@ -16,18 +16,25 @@ public static PlatformFileNameSuffixes CurrentPlatform { get { - switch (RuntimeEnvironment.OperatingSystemPlatform) + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - case Platform.Windows: - return Windows; - case Platform.Darwin: - return OSX; - case Platform.Linux: - return Linux; - case Platform.FreeBSD: - return FreeBSD; - default: - throw new InvalidOperationException("Unknown Platform"); + return Windows; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + return OSX; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + return Linux; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"))) + { + return FreeBSD; + } + else + { + throw new InvalidOperationException("Unknown Platform"); } } } diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/FrameworkDependencyFile.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/FrameworkDependencyFile.cs index b91f35fa0a2d..d8d7e75f3ac1 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/FrameworkDependencyFile.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/FrameworkDependencyFile.cs @@ -5,8 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.DotNet.PlatformAbstractions; - +using System.Runtime.InteropServices; using Microsoft.Extensions.DependencyModel; namespace Microsoft.DotNet.Cli.Utils @@ -28,11 +27,6 @@ public FrameworkDependencyFile() _dependencyContext = new Lazy(CreateDependencyContext); } - public bool SupportsCurrentRuntime() - { - return IsRuntimeSupported(RuntimeEnvironment.GetRuntimeIdentifier()); - } - public bool IsRuntimeSupported(string runtimeIdentifier) { return DependencyContext.RuntimeGraph.Any(g => g.Runtime == runtimeIdentifier); @@ -46,18 +40,20 @@ public string GetNetStandardLibraryVersion() ?.Version; } +#if NETCOREAPP public bool TryGetMostFitRuntimeIdentifier( string alternativeCurrentRuntimeIdentifier, string[] candidateRuntimeIdentifiers, out string mostFitRuntimeIdentifier) { return TryGetMostFitRuntimeIdentifier( - RuntimeEnvironment.GetRuntimeIdentifier(), + RuntimeInformation.RuntimeIdentifier, alternativeCurrentRuntimeIdentifier, DependencyContext.RuntimeGraph, candidateRuntimeIdentifiers, out mostFitRuntimeIdentifier); } +#endif internal static bool TryGetMostFitRuntimeIdentifier( string currentRuntimeIdentifier, diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj b/src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj index f48732109c52..556effc7b3ac 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj @@ -16,7 +16,6 @@ -