diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index 5845c7b3b3..913ffecdd4 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -569,8 +569,12 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( } else { - // Set the architecture specific variable to the environment of the process so it is picked up. - startInfo.EnvironmentVariables.Add(environmentVariableName, dotnetRootPath); + var architectureFromEnv = (Architecture)Enum.Parse(typeof(Architecture), dotnetRootArchitecture, ignoreCase: true); + if (architectureFromEnv == _architecture) + { + // Set the architecture specific variable to the environment of the process so it is picked up. + startInfo.EnvironmentVariables.Add(environmentVariableName, dotnetRootPath); + } } } else