diff --git a/src/BenchmarkDotNet/BenchmarkDotNet.csproj b/src/BenchmarkDotNet/BenchmarkDotNet.csproj index 4281fea2af..3eea2ce96b 100644 --- a/src/BenchmarkDotNet/BenchmarkDotNet.csproj +++ b/src/BenchmarkDotNet/BenchmarkDotNet.csproj @@ -30,7 +30,6 @@ - diff --git a/src/BenchmarkDotNet/Detectors/OsDetector.cs b/src/BenchmarkDotNet/Detectors/OsDetector.cs index af329042c6..cb0e717770 100644 --- a/src/BenchmarkDotNet/Detectors/OsDetector.cs +++ b/src/BenchmarkDotNet/Detectors/OsDetector.cs @@ -5,7 +5,6 @@ using System.Runtime.InteropServices; using System.Runtime.Versioning; using static System.Runtime.InteropServices.RuntimeInformation; -using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment; namespace BenchmarkDotNet.Detectors; @@ -53,8 +52,8 @@ private static OsInfo ResolveOs() } } - string operatingSystem = RuntimeEnvironment.OperatingSystem; - string operatingSystemVersion = RuntimeEnvironment.OperatingSystemVersion; + string operatingSystem = OSDescription; + string operatingSystemVersion = Environment.OSVersion.ToString(); if (IsWindows()) { int? ubr = GetWindowsUbr(); diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs index e396b9debd..7fb8b3fe32 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs @@ -1,12 +1,9 @@ using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; using BenchmarkDotNet.Detectors; using BenchmarkDotNet.Environments; using BenchmarkDotNet.Extensions; -using BenchmarkDotNet.Portability; using JetBrains.Annotations; -#if NETSTANDARD -using Microsoft.DotNet.PlatformAbstractions; -#endif namespace BenchmarkDotNet.Toolchains.DotNetCli { @@ -64,7 +61,7 @@ protected string GetTargetFrameworkMoniker() { if (targetFrameworkMoniker.IsNotBlank()) return targetFrameworkMoniker; - if (!RuntimeInformation.IsNetCore) + if (!Portability.RuntimeInformation.IsNetCore) throw new NotSupportedException("You must specify the target framework moniker in explicit way using builder.TargetFrameworkMoniker(tfm) method"); return CoreRuntime.GetCurrentVersion().MsBuildMoniker; @@ -130,12 +127,7 @@ internal static string GetPortableRuntimeIdentifier() // the values taken from https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#macos-rids string osPart = OsDetector.IsWindows() ? "win" : (OsDetector.IsMacOS() ? "osx" : "linux"); - string architecture = -#if NETSTANDARD - RuntimeEnvironment.RuntimeArchitecture; -#else - System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); -#endif + string architecture = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); return $"{osPart}-{architecture}"; }