diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs index 6448f7cc42d4b1..a06d545cd1c72b 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs @@ -24,6 +24,7 @@ public static partial class PlatformDetection public static bool IsWindows8x => IsWindows && GetWindowsVersion() == 6 && (GetWindowsMinorVersion() == 2 || GetWindowsMinorVersion() == 3); public static bool IsWindows8xOrLater => IsWindowsVersionOrLater(6, 2); public static bool IsWindows10OrLater => IsWindowsVersionOrLater(10, 0); + public static bool IsWindowsServer2019 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 17763; public static bool IsWindowsNanoServer => IsWindows && (IsNotWindowsIoTCore && GetWindowsInstallationType().Equals("Nano Server", StringComparison.OrdinalIgnoreCase)); public static bool IsWindowsServerCore => IsWindows && GetWindowsInstallationType().Equals("Server Core", StringComparison.OrdinalIgnoreCase); public static int WindowsVersion => IsWindows ? (int)GetWindowsVersion() : -1; @@ -173,6 +174,7 @@ internal static Version GetWindowsVersionObject() internal static uint GetWindowsVersion() => (uint)GetWindowsVersionObject().Major; internal static uint GetWindowsMinorVersion() => (uint)GetWindowsVersionObject().Minor; + internal static uint GetWindowsBuildVersion() => (uint)GetWindowsVersionObject().Build; internal static bool IsWindowsVersionOrLater(int major, int minor, int build = -1) { diff --git a/src/libraries/System.Globalization/tests/IcuTests.cs b/src/libraries/System.Globalization/tests/IcuTests.cs index 671c5036fbd979..0990c710f6d63b 100644 --- a/src/libraries/System.Globalization/tests/IcuTests.cs +++ b/src/libraries/System.Globalization/tests/IcuTests.cs @@ -10,7 +10,7 @@ namespace System.Globalization.Tests public class IcuTests { private static bool IsIcuCompatiblePlatform => PlatformDetection.IsNotWindows || - (PlatformDetection.IsWindows10Version1903OrGreater && + ((PlatformDetection.IsWindowsServer2019 || PlatformDetection.IsWindows10Version1903OrGreater) && // Server core doesn't have icu.dll on SysWOW64 !(PlatformDetection.IsWindowsServerCore && PlatformDetection.IsX86Process)); diff --git a/src/native/libs/System.Globalization.Native/pal_icushim.c b/src/native/libs/System.Globalization.Native/pal_icushim.c index 9f8994394e4afd..d23499c80b1ee1 100644 --- a/src/native/libs/System.Globalization.Native/pal_icushim.c +++ b/src/native/libs/System.Globalization.Native/pal_icushim.c @@ -100,6 +100,17 @@ static int FindICULibs() libicuuc = LoadLibraryExW(L"icu.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); if (libicuuc == NULL) { + // On Windows Server 2019, the ICU library is installed as icuuc.dll and icuin.dll. Try to load these. + libicuuc = LoadLibraryExW(L"icuuc.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (libicuuc != NULL) + { + libicui18n = LoadLibraryExW(L"icuin.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (libicui18n != NULL) + { + return true; + } + } + return false; }