Skip to content

Conversation

nohwnd
Copy link
Member

@nohwnd nohwnd commented Aug 19, 2025

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:

image

Reverting to broken behavior with the feature flag:

image

@nohwnd
Copy link
Member Author

nohwnd commented Aug 19, 2025

note for me:

tested on wsl with rc1 release , patched with the newly built testruntime provider.
cp /mnt/s/p/vstest/artifacts/bin/Microsoft.TestPlatform.TestHostProvider/Debug/netstandard2.0/Microsoft.TestPlatform.TestHostRuntimeProvider.dll dotnet3/sdk/10.0.100-rc.1.25418.110/Extensions/Microsoft.TestPlatform.TestHostRuntimeProvider.dll

Copy link
Member

@Youssef1313 Youssef1313 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff is kinda hard to follow with, but reading the overall logic, LGTM.

@nohwnd nohwnd enabled auto-merge (squash) August 19, 2025 15:45
@nohwnd nohwnd merged commit 9cbffb0 into microsoft:main Aug 19, 2025
6 checks passed
This was referenced Oct 2, 2025
This was referenced Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants