dotnet / dotnet/msbuild

Scope SDK-generated MSBuild paths to the current invocation

Open
#14,701 0 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 6h
Merged PRs (30d)
139

Description

### Problem

`dotnet` sets `MSBuildExtensionsPath` and `MSBuildSDKsPath` for its selected SDK. Descendant `dotnet` commands inherit those values even when they select a different SDK, which can mix SDK components and fail while loading tasks.

Failure: https://github.com/jaredpar/complog/actions/runs/31601500191/job/94129782284?pr=375
Repro/details: https://github.com/dotnet/msbuild/issues/14699

### Expected

SDK-generated paths should be scoped to the immediate MSBuild invocation, not exposed as ambient state to unrelated child processes. Explicit user overrides must remain supported.

The top-level CLI should decide the effective values and map them to MSBuild through CLI-owned startup state/properties; nested `dotnet` commands should compute paths for their own selected SDK.

### Design proposal

1. At CLI entry, read any explicit user overrides.
2. Otherwise compute paths from the SDK selected by that invocation.
3. Pass the effective paths only to the immediate MSBuild instance through CLI-owned startup state or global properties, rather than setting generated defaults in the ambient environment.
4. Propagate the values explicitly to MSBuild worker nodes.

This preserves intentional user overrides while allowing each nested `dotnet` invocation to use a coherent SDK.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked MSBuild issue #14699 and the referenced reproduction to understand how nested dotnet invocations inherit SDK paths. Trace the top-level CLI entry, MSBuild startup state or global properties, and worker-node propagation. Done means generated paths are scoped to the immediate invocation, nested SDK selections remain coherent, and explicit user overrides still work.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.