Skip to content

Resizetizer GetMauiItems does not propagate ProjectReference AdditionalPropertiesΒ #35574

Description

@mattleibow

Description

When a MAUI app is referenced as a library via ProjectReference with AdditionalProperties to suppress items like MauiIcon and MauiSplashScreen, Resizetizer's ResizetizeCollectItems target ignores those properties when calling GetMauiItems on the referenced project.

Steps to Reproduce

  1. Have a MAUI app project that conditionally strips MauiIcon/MauiSplashScreen when a property is set:
<ItemGroup Condition="'$(IsTestLibrary)' == 'true'">
    <MauiIcon Remove="@(MauiIcon)" />
    <MauiSplashScreen Remove="@(MauiSplashScreen)" />
</ItemGroup>
  1. Reference it from a test project with AdditionalProperties:
<ProjectReference Include="..\MyApp\MyApp.csproj">
    <AdditionalProperties>IsTestLibrary=true</AdditionalProperties>
</ProjectReference>
  1. The test project has its own MauiIcon with a different filename.

  2. Build β†’ error: One or more duplicate file names were detected. All image output filenames must be unique: appicon

Root Cause

In Microsoft.Maui.Resizetizer.After.targets, the ResizetizeCollectItems target calls:

<MSBuild
    Targets="GetMauiItems"
    Projects="%(_ResizetizeCollectItemsProject.Identity)"
    Properties="TargetFramework=%(_ResizetizeCollectItemsProject.NearestTargetFramework)"
    ...>

It only passes TargetFramework β€” it does not propagate AdditionalProperties or any other metadata from the original ProjectReference item. This means the referenced project evaluates GetMauiItems without the user's properties, so the conditional Remove never fires and the app's MauiIcon/MauiSplashScreen leak into the consuming project.

Expected Behavior

ResizetizeCollectItems should propagate AdditionalProperties (and/or SetConfiguration/SetPlatform) from the ProjectReference items when invoking GetMauiItems, similar to how the standard build graph respects these properties.

Workaround

Consuming projects must add a target to strip the imported items after collection:

<Target Name="_RemoveImportedAppIcon" AfterTargets="ResizetizeCollectItems">
    <ItemGroup>
        <MauiImage Remove="@(MauiImage)"
            Condition="'\%(MauiImage.Filename)' == 'appicon' and '\%(MauiImage.IsAppIcon)' == 'True'" />
    </ItemGroup>
</Target>

Context

This pattern is increasingly common for device testing scenarios where a test app references the real app as a library to test controls/ViewModels with real styles and resources. Both mattleibow/DeviceRunners and pictos/DeviceAppTest independently hit this and implemented the same workaround.

Suggested Fix

In ResizetizeCollectItems, when building the _ResizetizeCollectItemsProject items, carry over the AdditionalProperties metadata from the original ProjectReference items and append them to the Properties parameter of the MSBuild task call.

Activity

  1. added
    area-toolingXAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging
    on May 22, 2026
  2. added a commit that references this issue on May 30, 2026
    5943fdc
  3. added this to the .NET 10.0 SR8 milestone on May 30, 2026
  4. added a commit that references this issue on Jun 2, 2026
    2684f46
  5. added a commit that references this issue on Jun 11, 2026
    07b3f02
  6. added a commit that references this issue on Jun 22, 2026
    5ce7849
  7. added a commit that references this issue on Jun 25, 2026
    4bff51b
  8. added a commit that references this issue on Jul 3, 2026
    8d65a4a
  9. added a commit that references this issue on Jul 6, 2026
  10. locked and limited conversation to collaborators on Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-toolingXAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debuggings/triagedIssue has been reviewed

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions