Improve global.json SDK version validation for rollForward#742
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens global.json handling in setup-dotnet by validating sdk.version when rollForward is present (to avoid parsing errors) and by preventing the action’s rollForward “optimization” from rewriting prerelease SDK versions (so prerelease pins remain exact).
Changes:
- Add
sdk.versionformat validation (full SDK version required) before applying rollForward optimization. - Skip rollForward optimization entirely for prerelease SDK versions to ensure exact prerelease installs.
- Update documentation and e2e workflow coverage to reflect and exercise the new behavior.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/setup-dotnet.ts |
Adds sdk.version validation for rollForward and skips optimization for prerelease versions. |
README.md |
Documents that prerelease SDK pins are installed exactly regardless of rollForward. |
dist/setup/index.js |
Updates the compiled distribution output to match the TypeScript changes. |
.github/workflows/e2e-tests.yml |
Adjusts e2e rollForward test inputs to use a full SDK version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Shouldn't version be validated even if rollForward isn't specified? It has a default value even if not present. From the docs https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#matching-rules
|
|
@Frulfump, The validation is scoped to this case because the |
|
It could be a warning not necessarily a hard break to guide users to a valid global.json and it already has a default value so it's always there from the .NET SDKs perspective at least. |
|
Thanks for the follow-up, @Frulfump. We really appreciate you digging into this. Just one quick clarification on the mechanics. The
For that reason, the hard error in this PR is intentionally scoped to the Hope that helps clarify the intent. |
|
@priyagupta108 Thanks for the additional info. That makes sense! |
|
This broke us 😄 We were, admittedly + wrongly, doing |
|
There's an issues here for that if you want to follow / upvote that. #753 And here's the .NET SDK issue to turn it into an error instead of just informational dotnet/sdk#49816 |
Description:
This PR validates the
sdk.versionformat inglobal.jsonwhenrollForwardis specified and skips rollForward optimization for prerelease SDK versions.Related issue:
#739
#740
Check list: