Set dotnet_root_ always by nohwnd · Pull Request #15266 · microsoft/vstest (original) (raw)
Description
Always set DOTNET_ROOT_ (e.g. DOTNET_ROOT_X64) when running under dotnet test, to make sure that the location of dotnet".exe", propagates to the testhost and child processes when we are on windows, linux and macos. This allows local installations of dotnet to be used to run tests that run child executables. On Windows this is alread in place for a long time when testhost.exe is found, so it can resolve correctly dotnet that is not in program files.
On Linux and MacOS it will be used to run xunit v3 tests.
There is a feature flag to disable this new behavior: VSTEST_DISABLE_DOTNET_ROOT_ON_NONWINDOWS=1
Related issue
Will fix dotnet/sdk#50331 once merged and flown.
Working:
Reverting to broken behavior with the feature flag:

