Skip to content

Set DOTNET_ROOT in VSTestForwardingApp#13619

Merged
ViktorHofer merged 3 commits into
dotnet:masterfrom
ViktorHofer:SetDotNetRootAlways
Sep 16, 2020
Merged

Set DOTNET_ROOT in VSTestForwardingApp#13619
ViktorHofer merged 3 commits into
dotnet:masterfrom
ViktorHofer:SetDotNetRootAlways

Conversation

@ViktorHofer

@ViktorHofer ViktorHofer commented Sep 15, 2020

Copy link
Copy Markdown
Member

Customer Impact

3.1 introduced support for using dotnet test to invoke a test project or an assembly. This means that dotnet vstest which was used to invoke a test assembly is de facto deprecated as it's replaced by dotnet test. Testing a test assembly with dotnet test on Windows results in the testhost (which uses the apphost feature) not being able to find the runtime because DOTNET_ROOT isn't set.

Testing

The PR adds product tests. In addition to that we have coverage from "arcadified" repos like mono/linker.

Risk

Low. The touched path is already broken and the change only involves setting an environment variable.

The assumption is that this issue hasn't come up yet as the feature isn't documented yet and hence not many are using it. FWIW, Arcade uses it when using the VSTest runner instead of xunit.console (feature switch).

cc @nohwnd

Fixes #13611

When invoking dotnet test on an assembly, DOTNET_ROOT isn't set and
the testhost will fail to find a matching shared framework. This only
happens on Windows as the apphost feature is used there to differentiate
between x86 and x64.
@ViktorHofer ViktorHofer requested a review from nohwnd September 15, 2020 21:08
@ViktorHofer ViktorHofer self-assigned this Sep 15, 2020
@ViktorHofer

Copy link
Copy Markdown
Member Author

@nohwnd can you maybe help me validate this by adding a test? Unsure how tests work in this repo.

Comment thread src/Cli/dotnet/commands/dotnet-test/VSTestForwardingApp.cs Outdated
@ViktorHofer ViktorHofer merged commit dd138ea into dotnet:master Sep 16, 2020
@ViktorHofer ViktorHofer deleted the SetDotNetRootAlways branch September 16, 2020 19:06
@ViktorHofer ViktorHofer restored the SetDotNetRootAlways branch September 16, 2020 19:06
@ViktorHofer ViktorHofer deleted the SetDotNetRootAlways branch September 16, 2020 19:06
@ViktorHofer ViktorHofer restored the SetDotNetRootAlways branch September 16, 2020 19:10
ViktorHofer added a commit that referenced this pull request Sep 16, 2020
* Set DOTNET_ROOT in VSTestForwardingApp

When invoking dotnet test on an assembly, DOTNET_ROOT isn't set and
the testhost will fail to find a matching shared framework. This only
happens on Windows as the apphost feature is used there to differentiate
between x86 and x64.

* Add tests

* Reuse GetRootVariable

Co-authored-by: nohwnd <me@jakubjares.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotnet test with source assembly doesn't set DOTNET_ROOT

2 participants