Fix NativeAOT to use AndroidLinkMode=Full instead of SdkOnly - #10809
Merged
Conversation
- Add AndroidLinkMode=Full default for NativeAOT before existing defaults - Remove redundant NativeAOT check from TrimMode condition - This resolves the contradiction where NativeAOT would get SdkOnly link mode but full trimming Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix AndroidLinkMode and TrimMode conflict in Release configuration
Fix NativeAOT to use AndroidLinkMode=Full instead of SdkOnly
Feb 12, 2026
sbomer
marked this pull request as ready for review
February 12, 2026 23:01
sbomer
requested review from
grendello,
jonathanpeppers and
simonrozsival
as code owners
February 12, 2026 23:01
sbomer
approved these changes
Feb 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts MSBuild default trimming/linking properties so NativeAOT builds don’t end up with conflicting defaults (AndroidLinkMode=SdkOnly vs TrimMode=full) in the .NET for Android SDK targets.
Changes:
- Default
AndroidLinkModetoFullwhen$(_AndroidRuntime)isNativeAOT, ahead of existing fallback defaults. - Simplify the
TrimModedefault condition to follow fromAndroidLinkMode=Full(removing the redundant NativeAOT runtime check). - Fix indentation on an adjacent line to match repository formatting.
grendello
approved these changes
Feb 13, 2026
simonrozsival
approved these changes
Feb 13, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
NativeAOT was getting
AndroidLinkMode=SdkOnly(BCL-only trimming) butTrimMode=full(aggressive trimming), creating a contradiction.Changes
AndroidLinkMode=Fulldefault for NativeAOT before existing fallback conditions'$(_AndroidRuntime)' == 'NativeAOT'check fromTrimModecondition—now follows naturally fromAndroidLinkMode=FullNon-NativeAOT configurations (CoreCLR, MonoVM, Debug) remain unchanged.
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.