diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index 20310de045..0c509e7502 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -472,19 +472,19 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( if (testHostExeFound) { const string prefix = "VSTEST_WINAPPHOST_"; - const string DOTNET_ROOT = nameof(DOTNET_ROOT); - string vstestDotnetRootEnvName = $"{prefix}{DOTNET_ROOT}(x86)"; + const string dotnetRoot = "DOTNET_ROOT"; + string vstestDotnetRootEnvName = $"{prefix}{dotnetRoot}(x86)"; var vstestDotnetRootEnvValue = _environmentVariableHelper.GetEnvironmentVariable(vstestDotnetRootEnvName); if (vstestDotnetRootEnvValue is null) { - vstestDotnetRootEnvName = $"{prefix}{DOTNET_ROOT}"; + vstestDotnetRootEnvName = $"{prefix}{dotnetRoot}"; vstestDotnetRootEnvValue = _environmentVariableHelper.GetEnvironmentVariable(vstestDotnetRootEnvName); } if (vstestDotnetRootEnvValue != null) { string dotnetRootEnvName = Version.Parse(_targetFramework.Version) >= Version6_0 - ? $"{DOTNET_ROOT}_{_architecture.ToString().ToUpperInvariant()}" + ? $"{dotnetRoot}_{_architecture.ToString().ToUpperInvariant()}" : vstestDotnetRootEnvName.Replace(prefix, string.Empty); EqtTrace.Verbose($"DotnetTestHostmanager.LaunchTestHostAsync: Found '{vstestDotnetRootEnvName}' in env variables, value '{vstestDotnetRootEnvValue}', forwarding to '{dotnetRootEnvName}' (target framework is {_targetFramework.Name}, Version={_targetFramework.Version}).");