Fix NETSDK1242 build error on NativeAOT and the Mono smoke test#130292
Merged
kotlarmilos merged 2 commits intoJul 8, 2026
Merged
Fix NETSDK1242 build error on NativeAOT and the Mono smoke test#130292kotlarmilos merged 2 commits into
kotlarmilos merged 2 commits into
Conversation
The .NET 11 SDK 11.0.100-preview.6.26352.110 added check NETSDK1242, which errors when a project targets a mobile platform (ios/tvos/maccatalyst/android) with the Mono runtime. The CoreCLR mobile legs already pass /p:UseMonoRuntime=false so the check never fires for them, but the NativeAOT legs do not, so the mobile inner target frameworks of the multi-targeted libs.tests projects default to Mono during restore and fail the build. Force UseMonoRuntime off whenever UseNativeAOTRuntime is set, since NativeAOT is CoreCLR-based and never uses Mono. Separately, set the SDK opt-out on the single Mono iOS simulator smoke test, which intentionally builds the product with Mono and therefore cannot turn UseMonoRuntime off. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @akoeplinger, @matouskozak, @simonrozsival |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts repo-wide MSBuild defaults and one iOS simulator pipeline leg to avoid SDK error NETSDK1242 when restoring/building multi-targeted projects that include mobile TFMs.
Changes:
- Default
UseMonoRuntimetofalsewhenUseNativeAOTRuntime=true, to prevent mobile inner TFMs from implicitly selecting Mono during restore. - Opt the Mono iOS simulator smoke-test pipeline leg out of the SDK’s unsupported Mono mobile runtime check via
/p:_DisableCheckForUnsupportedMonoMobileRuntime=true.
Show a summary per file
| File | Description |
|---|---|
eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml |
Adds an SDK-check opt-out property to the Mono iOS simulator smoke-test build arguments. |
Directory.Build.props |
Defaults UseMonoRuntime=false when UseNativeAOTRuntime=true to avoid NETSDK1242 during restore of multi-targeted projects. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Member
Author
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
vitek-karas
approved these changes
Jul 7, 2026
This was referenced Jul 7, 2026
Open
This was referenced Jul 7, 2026
kotlarmilos
enabled auto-merge (squash)
July 7, 2026 20:27
This was referenced Jul 7, 2026
Member
Author
|
/ba-g Native AOT builds and Mono smoke tests succeeded |
eiriktsarpalis
pushed a commit
that referenced
this pull request
Jul 15, 2026
) ## Description The latest .NET 11 SDK started enforcing `NETSDK1242`, which fails the build when a project targets a mobile platform with the Mono runtime. The CoreCLR mobile legs already pass `/p:UseMonoRuntime=false`, so the check never fires for them, but the NativeAOT legs do not, so during restore the mobile target frameworks of the multi-targeted `libs.tests` projects default to Mono and fail the build. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Description
The latest .NET 11 SDK started enforcing
NETSDK1242, which fails the build when a project targets a mobile platform with the Mono runtime. The CoreCLR mobile legs already pass/p:UseMonoRuntime=false, so the check never fires for them, but the NativeAOT legs do not, so during restore the mobile target frameworks of the multi-targetedlibs.testsprojects default to Mono and fail the build.