KEMBAR78
[NET 10] Fix UseInterpreter being set for non-MAUI projects referencing MAUI class libraries by jsuarezruiz · Pull Request #30482 · dotnet/maui · GitHub
Skip to content

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

UseInterpreter=True is set for any project that references the Microsoft.Maui.Controls NuGet package, including non-MAUI projects like regular .NET class libraries and macOS applications.

This PR includes changes to add a condition to only set UseInterpreter=True when the project targets actual MAUI platforms. Examples:

  • net10.0 (.NET library): UseInterpreter NOT set
  • net10.0-macos (macOS app): UseInterpreter NOT set
  • net10.0-android (MAUI Android): UseInterpreter = True

There changes fixes the build failure for non-MAUI projects referencing MAUI libraries while preserves existing functionality for actual MAUI projects.

Issues Fixed

Fixes #21653

@Copilot Copilot AI review requested due to automatic review settings July 8, 2025 07:32
@jsuarezruiz jsuarezruiz requested a review from a team as a code owner July 8, 2025 07:32
@jsuarezruiz jsuarezruiz added platform/macos macOS / Mac Catalyst area-templates Project templates, Item Templates for Blazor and MAUI labels Jul 8, 2025
Copy link
Contributor

@Copilot 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 PR prevents UseInterpreter=True from being applied to non-MAUI projects by adding platform checks to the MSBuild condition.

  • Restricts UseInterpreter to actual MAUI target platforms only (Android, iOS, MacCatalyst, Windows, Tizen).
  • Removes unconditional interpreter setting for plain .NET and macOS TFMs.
Comments suppressed due to low confidence (2)

src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.Common.targets:6

  • Add automated UI/build tests in TestCases.HostApp and TestCases.Shared.Tests to verify that UseInterpreter is only set for MAUI target frameworks and not for plain .NET or macOS TFMs.
    <UseInterpreter Condition="'$(UseInterpreter)' == '' and '$(Configuration)' == 'Debug' and 

src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.Common.targets:6

  • Update the public XML documentation in the /docs/ folder to reflect that UseInterpreter now only applies to actual MAUI platforms.
    <UseInterpreter Condition="'$(UseInterpreter)' == '' and '$(Configuration)' == 'Debug' and 

@PureWeen PureWeen added this to the .NET 10.0-preview7 milestone Jul 9, 2025
@PureWeen PureWeen added the p/0 Work that we can't release without label Jul 9, 2025
@github-project-automation github-project-automation bot moved this from Todo to Approved in MAUI SDK Ongoing Jul 11, 2025
@rmarinho rmarinho merged commit bfbab9e into net10.0 Jul 11, 2025
122 of 129 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Jul 11, 2025
@rmarinho rmarinho deleted the fix-21653 branch July 11, 2025 10:57
@github-actions github-actions bot locked and limited conversation to collaborators Aug 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-templates Project templates, Item Templates for Blazor and MAUI p/0 Work that we can't release without platform/macos macOS / Mac Catalyst

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants