From 477990c8272d76a99ec93e389a47300a69b54216 Mon Sep 17 00:00:00 2001 From: Charlie Poole Date: Wed, 11 Jan 2023 01:20:02 -0800 Subject: [PATCH] Use x86 dotnet install path when running an x86 test assembly --- .../nunit.engine.core/Internal/TestAssemblyResolver.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NUnitEngine/nunit.engine.core/Internal/TestAssemblyResolver.cs b/src/NUnitEngine/nunit.engine.core/Internal/TestAssemblyResolver.cs index 5d8357a85..4a285e41d 100644 --- a/src/NUnitEngine/nunit.engine.core/Internal/TestAssemblyResolver.cs +++ b/src/NUnitEngine/nunit.engine.core/Internal/TestAssemblyResolver.cs @@ -97,7 +97,9 @@ private static string GetDotNetInstallDirectory() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // Running on Windows so use registry - RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\dotnet\SetUp\InstalledVersions\x64\sharedHost\"); + RegistryKey key = Environment.Is64BitProcess + ? Registry.LocalMachine.OpenSubKey(@"Software\dotnet\SetUp\InstalledVersions\x64\sharedHost\") + : Registry.LocalMachine.OpenSubKey(@"Software\dotnet\SetUp\InstalledVersions\x86\sharedHost\"); return (string)key?.GetValue("Path"); } else