Skip to content

Conversation

@mattleibow
Copy link
Member

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:

  • In MauiApp.1.csproj (both maui-blazor-solution and maui-blazor templates), MauiLib1.csproj, and MauiApp.1.csproj (maui-mobile template), 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]
  • The Windows target framework is still conditionally added if the build is running on Windows, preserving existing Windows compatibility logic. [1] [2] [3] [4]

Copilot AI review requested due to automatic review settings October 23, 2025 22:44
Copy link
Contributor

Copilot AI left a 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

Comment on lines +4 to 6
<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>
Copy link

Copilot AI Oct 23, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +4 to 6
<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>
Copy link

Copilot AI Oct 23, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +4 to 6
<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>
Copy link

Copilot AI Oct 23, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +4 to 6
<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>
Copy link

Copilot AI Oct 23, 2025

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.

Copilot uses AI. Check for mistakes.
@rmarinho rmarinho merged commit dc8b538 into net10.0 Oct 24, 2025
19 checks passed
@rmarinho rmarinho deleted the dev/templates branch October 24, 2025 07:41
@PureWeen PureWeen added the area-templates Project templates, Item Templates for Blazor and MAUI label Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-templates Project templates, Item Templates for Blazor and MAUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants