Skip to content

Consider Only Conditionally Overriding DOTNET_ROOT #13365

@nagilson

Description

@nagilson

Description

export DOTNET_ROOT=$HOME/.dotnet

The .bashrc configuration for the Mac OS image sets DOTNET_ROOT always. It's very common to want to use a custom .NET root folder in a private install location and to my knowledge, this runner may override the custom environment variable when tests run on the image in a pipeline.

I would advise that you conditionally set DOTNET_ROOT if and only if it is not set, at least if it is set to any non-default value for DOTNET_ROOT, such as the default system hive location on Mac OSX. Note that the system default hive location is platform specific depending upon arm64 v x64 architecture.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 22.04
  • Ubuntu 24.04
  • Ubuntu Slim
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • macOS 26 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Image version and build link

export DOTNET_ROOT=$HOME/.dotnet

https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=12843965&view=logs&j=d1a37dfc-4cfe-5bcf-d646-57ef030f3cc5&t=b3bff06d-614b-5714-bf9e-b3b8549da584

Is it regression?

Not to my knowledge.

Expected behavior

Test runner respects DOTNET_ROOT custom settings.

Actual behavior

Image bashrc overrides DOTNET_ROOT.

Repro steps

Try to write a scenario that requires a custom DOTNET_ROOT folder to be set to use a private runtime not on the PATH environment variable, and run on the mac image to see whether DOTNET_ROOT is overriden when we run a program/process through the shell that required the custom DOTNET_ROOT variable.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions