[mobile] .NET 11 mobile runtime configuration updates - #54713
Conversation
…n .NET 11 Add NETSDK1242 so building an Android or Apple mobile project with UseMonoRuntime=true on net11.0 or later fails with a clear message directing users to the .NET 10 SDK, instead of a silent missing-pack error. WebAssembly Mono, CoreCLR, NativeAOT, and the platform workloads are unaffected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📋 SDK Diagnostic Documentation ReminderThis PR introduces 1 new SDK diagnostic code:
Action RequiredPlease ensure that documentation for this diagnostic is added or updated in the dotnet/docs repository at:
Each diagnostic should have:
Thank you for helping keep our documentation up to date! 🙏 |
3e8d249 to
45d442a
Compare
Building with the .NET 10 SDK does not resolve the error when the project targets .NET 11.0 or later, so the previous message was misleading. Point users at the two real fixes: use the CoreCLR runtime, or target .NET 10.0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Gate the NETSDK1242 check on a private _DisableCheckForUnsupportedMonoMobileRuntime property so a project can opt out during the transition. The escape hatch stops working once the runtime packs are removed, which is acceptable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds an SDK build-time validation that emits a new error (NETSDK1242) when UseMonoRuntime=true is used for Android or Apple mobile TFMs on .NET 11.0+ (directing users to switch to CoreCLR or target .NET 10.0), avoiding later/less-clear missing-pack failures.
Changes:
- Adds
_CheckForUnsupportedMonoMobileRuntimeto fail early for.NETCoreApp+UseMonoRuntime=true+net11.0++ (android/ios/tvos/maccatalyst). - Introduces the new resource string
MonoRuntimeNotSupportedForPlatformwith error codeNETSDK1242. - Updates all localized XLF files with the new trans-unit for
NETSDK1242.
Show a summary per file
| File | Description |
|---|---|
| src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets | Adds early validation target that throws NETSDK1242 for unsupported Mono mobile runtime usage on net11.0+. |
| src/Tasks/Common/Resources/Strings.resx | Adds MonoRuntimeNotSupportedForPlatform (NETSDK1242) and updates the “latest message added” guard comment. |
| src/Tasks/Common/Resources/xlf/Strings.cs.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.de.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.es.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.fr.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.it.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.ja.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.ko.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.pl.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.ru.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.tr.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
| src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf | Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242). |
Copilot's findings
- Files reviewed: 15/15 changed files
- Comments generated: 1
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
The Czech xlf source text was not regenerated after the NETSDK1242 message was shortened, causing XliffTasks to fail the out-of-date check across all build legs. Align the cs.xlf source with Strings.resx. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
This change prevents the ability to build the runtime repo with Mono runtime. See dotnet/source-build#5603 |
|
@mthalman I would set |
I can do that but this would be a breaking change for downstream source-build distro partners that need to build with Mono runtime. Unfortunately, this change made its way into the |
Oh never mind. Not sure what I was thinking. |
The .NET 11 SDK blocks UseMonoRuntime for mobile TFMs (NETSDK1242). Pass /p:_DisableCheckForUnsupportedMonoMobileRuntime=true (the SDK's supported opt-out, dotnet/sdk#54713) alongside UseMonoRuntime=true for the Mono inner-loop variant so restore + build succeed on net11.0-ios. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
Add build error NETSDK1242 so that building Android or Apple mobile projects with UseMonoRuntime=true on the .NET 11 SDK fails with a clear message directing users to the .NET 10 SDK, instead of a silent missing-pack error. Implemented via _CheckForUnsupportedMonoMobileRuntime in Microsoft.NET.TargetFrameworkInference.targets and the NETSDK1242 string (Strings.resx and 13 xlf translations).
Validation pipelines (must pass): dotnet-sdk-public PR build.