-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Make MAUI instantly compilable on Linux #32186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request enables MAUI projects to compile successfully on Linux by conditionally excluding iOS and MacCatalyst target frameworks on that platform. The changes ensure that when building on Linux, only Android (and optionally Windows when on Windows) targets are included, preventing build failures due to missing iOS/MacCatalyst SDKs.
Key changes:
- Modified target framework selection to default to Android-only
- Added conditional inclusion of iOS/MacCatalyst targets based on OS platform detection
- Preserved existing Windows conditional target framework logic
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Templates/src/templates/maui-mobile/MauiApp.1.csproj | Updated to conditionally exclude iOS/MacCatalyst on Linux |
| src/Templates/src/templates/maui-lib/MauiLib1.csproj | Updated to conditionally exclude iOS/MacCatalyst on Linux |
| src/Templates/src/templates/maui-blazor/MauiApp.1.csproj | Updated to conditionally exclude iOS/MacCatalyst on Linux |
| src/Templates/src/templates/maui-blazor-solution/MauiApp.1/MauiApp.1.csproj | Updated to conditionally exclude iOS/MacCatalyst on Linux |
| <TargetFrameworks>DOTNET_TFM-android</TargetFrameworks> | ||
| <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);DOTNET_TFM-ios;DOTNET_TFM-maccatalyst</TargetFrameworks> | ||
| <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);DOTNET_TFM-windows10.0.19041.0</TargetFrameworks> |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes modify the default target frameworks in public project templates, which is a breaking change for users who expect iOS and MacCatalyst to be included by default on macOS. Consider whether this should be a major version change or if the condition should specifically check for macOS availability rather than excluding based on Linux.
| <TargetFrameworks>DOTNET_TFM-android</TargetFrameworks> | ||
| <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);DOTNET_TFM-ios;DOTNET_TFM-maccatalyst</TargetFrameworks> | ||
| <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);DOTNET_TFM-windows10.0.19041.0</TargetFrameworks> |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes modify the default target frameworks in public project templates, which is a breaking change for users who expect iOS and MacCatalyst to be included by default on macOS. Consider whether this should be a major version change or if the condition should specifically check for macOS availability rather than excluding based on Linux.
| <TargetFrameworks>DOTNET_TFM-android</TargetFrameworks> | ||
| <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);DOTNET_TFM-ios;DOTNET_TFM-maccatalyst</TargetFrameworks> | ||
| <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);DOTNET_TFM-windows10.0.19041.0</TargetFrameworks> |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes modify the default target frameworks in public project templates, which is a breaking change for users who expect iOS and MacCatalyst to be included by default on macOS. Consider whether this should be a major version change or if the condition should specifically check for macOS availability rather than excluding based on Linux.
| <TargetFrameworks>DOTNET_TFM-android</TargetFrameworks> | ||
| <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);DOTNET_TFM-ios;DOTNET_TFM-maccatalyst</TargetFrameworks> | ||
| <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);DOTNET_TFM-windows10.0.19041.0</TargetFrameworks> |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes modify the default target frameworks in public project templates, which is a breaking change for users who expect iOS and MacCatalyst to be included by default on macOS. Consider whether this should be a major version change or if the condition should specifically check for macOS availability rather than excluding based on Linux.
This pull request updates the target framework selection logic in several MAUI project templates to improve cross-platform compatibility. The main change is to ensure that iOS and MacCatalyst targets are only included on platforms that support them, specifically excluding them when building on Linux.
Fixes #14088
Cross-platform build logic updates:
MauiApp.1.csproj(bothmaui-blazor-solutionandmaui-blazortemplates),MauiLib1.csproj, andMauiApp.1.csproj(maui-mobiletemplate), the default target frameworks are set to only Android. Additional target frameworks for iOS and MacCatalyst are now conditionally added only if the build is not running on Linux. [1] [2] [3] [4]