Skip to content

Improve SDK resolver error messages when global.json rollforward selects an incompatible SDK#53632

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/improve-error-message-sdk-resolution
Draft

Improve SDK resolver error messages when global.json rollforward selects an incompatible SDK#53632
Copilot wants to merge 1 commit intomainfrom
copilot/improve-error-message-sdk-resolution

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

When global.json specifies a rollForward policy that causes a newer SDK to be selected, and that SDK fails the MSBuild minimum version check or the VS-defined minimum SDK version check, the error today mentions only the resolved SDK version—not that it was chosen via rollforward. Users see a confusing mismatch between what they put in global.json and the version being complained about.

Changes

  • New error strings (Strings.resx): Two rollforward-specific variants of the existing version-mismatch messages that surface the global.json path, the originally-requested version, and actionable guidance to adjust rollForward.
  • Detection logic (MSBuildSdkResolver.cs): Added IsGlobalJsonRollforward helper — fires when GlobalJsonPath is set and the resolved SDK version differs from RequestedVersion. Both version-check failure paths branch to the new messages when rollforward is detected.
  • Tests (GivenAnMSBuildSdkResolver.cs): Extended CreateGlobalJson with an optional rollForward parameter; added two tests covering each new error path.

Before:

Version 10.0.200 of the .NET SDK requires at least version 17.12 of MSBuild. The current available version of MSBuild is 16.8. Change the .NET SDK specified in global.json to an older version…

After:

Version 10.0.200 of the .NET SDK requires at least version 17.12 of MSBuild. The current available version of MSBuild is 16.8. The .NET SDK 10.0.200 was automatically selected via the rollforward policy applied to version '9.0.100' as specified in global.json ('/repo/global.json'). Consider changing the rollForward setting in global.json to prevent automatically selecting a .NET SDK version that is incompatible with the installed MSBuild.

…atible SDK

Agent-Logs-Url: https://github.com/dotnet/sdk/sessions/653e8d69-6576-467e-a866-65f14243ffc2

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.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.

2 participants