diff --git a/src/managed/Microsoft.DotNet.PlatformAbstractions/RuntimeEnvironment.cs b/src/managed/Microsoft.DotNet.PlatformAbstractions/RuntimeEnvironment.cs index 5cd62889f4..ffece180eb 100644 --- a/src/managed/Microsoft.DotNet.PlatformAbstractions/RuntimeEnvironment.cs +++ b/src/managed/Microsoft.DotNet.PlatformAbstractions/RuntimeEnvironment.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Runtime.InteropServices; using Microsoft.DotNet.PlatformAbstractions.Native; namespace Microsoft.DotNet.PlatformAbstractions @@ -23,7 +24,7 @@ private static string GetArch() #if NET45 return Environment.Is64BitProcess ? "x64" : "x86"; #else - return IntPtr.Size == 8 ? "x64" : "x86"; + return RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); #endif } @@ -36,11 +37,7 @@ public static string GetRuntimeIdentifier() private static string GetRIDArch() { - if (!string.IsNullOrEmpty(RuntimeArchitecture)) - { - return $"-{RuntimeArchitecture.ToLowerInvariant()}"; - } - return string.Empty; + return $"-{RuntimeArchitecture}"; } private static string GetRIDVersion()