Skip to content

Gate net9.0 mobile TFMs on a .NET 9+ SDK so net8 source-linkers restore cleanly#3395

Merged
vchelaru merged 1 commit into
mainfrom
mobile-tfm-sdk-gate
Jun 28, 2026
Merged

Gate net9.0 mobile TFMs on a .NET 9+ SDK so net8 source-linkers restore cleanly#3395
vchelaru merged 1 commit into
mainfrom
mobile-tfm-sdk-gate

Conversation

@vchelaru

Copy link
Copy Markdown
Owner

Summary

Gates the net9.0-ios / net9.0-android target frameworks on the active SDK being .NET 9+, so consumers pinned to the .NET 8 SDK can restore MonoGameGum.csproj cleanly.

Problem

The mobile TFMs were added to TargetFrameworks gated only on the existing ExcludeIOS / ExcludeAndroid build-time escape hatches. Those flags are ProjectReference AdditionalProperties, which do not flow through NuGet restore. A .NET 8 SDK cannot evaluate a net9.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 the ExcludeIOS hatch can ever apply.

Fix

Add an SDK-version gate to the mobile TFM conditions:

Condition="'$(ExcludeIOS)' != 'true' AND $([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '9.0'))"

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.sln building green and unchanged behavior on a .NET 9+ SDK.

🤖 Generated with Claude Code

…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>
@vchelaru vchelaru merged commit ee6c8dd into main Jun 28, 2026
3 checks passed
@vchelaru vchelaru deleted the mobile-tfm-sdk-gate branch June 28, 2026 00:14
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.

1 participant