Gate net9.0 mobile TFMs on a .NET 9+ SDK so net8 source-linkers restore cleanly#3395
Merged
Conversation
…re cleanly net9.0-ios/android were added to TargetFrameworks gated only on the ExcludeIOS/ExcludeAndroid escape hatches. Those flags are ProjectReference AdditionalProperties, which do NOT flow through NuGet restore — and a .NET 8 SDK cannot evaluate a net9.0-* TFM at all (NETSDK1139). So a source-linking consumer pinned to the .NET 8 SDK (FRB, link-to-source scratch templates) breaks on restore before the build-time hatches can apply. Add an SDK-version gate (NETCoreSdkVersion >= 9.0) to the mobile TFM conditions. net9+ SDK builds still get the mobile targets; net8-SDK restores skip them cleanly instead of erroring. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Gates the
net9.0-ios/net9.0-androidtarget frameworks on the active SDK being .NET 9+, so consumers pinned to the .NET 8 SDK can restoreMonoGameGum.csprojcleanly.Problem
The mobile TFMs were added to
TargetFrameworksgated only on the existingExcludeIOS/ExcludeAndroidbuild-time escape hatches. Those flags areProjectReferenceAdditionalProperties, which do not flow through NuGet restore. A .NET 8 SDK cannot evaluate anet9.0-*TFM at all (NETSDK1139), and that evaluation happens during restore — so a source-linking consumer pinned to the .NET 8 SDK (FRB, the link-to-source scratch templates) breaks on restore before theExcludeIOShatch can ever apply.Fix
Add an SDK-version gate to the mobile TFM conditions:
net9+SDK builds still get the mobile targets;net8-SDK restores skip them cleanly instead of erroring. Additive and safe — the only behavior that changes is sub-9 SDK restores, which previously errored.Manual test: not needed — build/restore plumbing; verified by
GumFull.slnbuilding green and unchanged behavior on a .NET 9+ SDK.🤖 Generated with Claude Code