Skip to content

Stop setting DOTNET_ROOT in dotnet test #3586

@rseanhall

Description

@rseanhall

Description

dotnet test is always setting the DOTNET_ROOT environment variable in the testhost.exe process. Before .NET 6, this was ignored in x86 processes with standard fxr resolver logic. Starting in .NET 6, the standard fxr resolver logic will use this location even if it is the wrong architecture.

Steps to reproduce

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0-windows</TargetFramework>
    <PlatformTarget>x64</PlatformTarget>
    <RollForward>Major</RollForward>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" />
    <PackageReference Include="xunit" />
    <PackageReference Include="xunit.runner.visualstudio" PrivateAssets="All" />
  </ItemGroup>
</Project>

Expected behavior

DOTNET_ROOT is not set in the testhost.exe process. DOTNET_ROOT_x64 may or may not be set.

Actual behavior

DOTNET_ROOT is set.

Further information can be found in dotnet/runtime#68180.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions