Allow the muxer to skip global.json resolution entirely

Open
#118,488 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
build-system, cli

Research direction

Start by locating the .NET muxer entry point and its global.json probing logic, then inspect existing environment-variable controls and related documentation. Define how a documented opt-out should make probing rely on the process environment, and verify the behavior with the muxer's resolution or integration tests; the payload does not name specific files or tests.

Written by the indexing model from the issue text.

Description

area-Host

As the SDK and MSBuild teams have started adopting the sdk.paths feature in global.json, one thing we've noticed is that there are scenarios in which can make testing harder. These repos often do integration-level testing of an SDK-like layout in situ - and this often involves running dotnet- or msbuild.exe-based commands that intended to work on cutomized SDK layouts/roots.

It is relatively easy for us to configure these scenarios/environments to use these custom SDK roots by setting the following env vars:

  • PATH - to ensure the muxer in the layout root is used,
  • DOTNET_ROOT - to ensure the layout root is used when probing for Runtimes, and
  • DOTNET_HOST_PATH - to ensure that the muxer in the layout root isn't confused for the 'outer' dotnet.exe that started the testing host process, etc.

However, these tests are still vulnerable to SDK-resolution hijacking by global.jsons in the repo roots - especially with sdk.paths where the repo-local root may not have all of the runtimes the tests may require. To work around this, we've resorted to creating a 'dummy' global.json in the testing root file system heirarchy to act as a forced-stop for the global.json probing logic in the muxer.

Instead of generating this file, we feel it would be more understandable if the muxer itself had a documented knob that said "don't try to probe for global.json at all, just use the process environment to do probing".

Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.