Skip to content

MauiImage with LogicalName containing path - is not working on Windows #32356

@LaoR-UA

Description

@LaoR-UA

Description

Considering the following .csproj configuration:

<ItemGroup>
	<!-- Images -->
	<MauiImage Include="Resources\Images\*" />
	<MauiImage Include="Resources\Images\Challenges\*" LogicalName="challenges/%(Filename)%(Extension)" />
	<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />

	<!-- Custom Fonts -->
	<MauiFont Include="Resources\Fonts\*" />

	<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
	<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

I cannot display an image on Windows using path to that logical file:
<Image Grid.Row="0" Grid.Column="0" Aspect="AspectFit" Source="challenges/hard.png" MaximumHeightRequest="150" />
But it is working on Android.

Steps to Reproduce

  1. Crate MAUI app using a default tempalte.
  2. Edit .csproj by adding the next line to any <ItemGroup> containing image references: <MauiImage Include="Resources\Images\Challenges\*" LogicalName="challenges/%(Filename)%(Extension)" />
  3. Add test.png image to '\Resources\Images\Challenges' folder.
  4. Add replace the Source binding propety's value for Image on main page with 'challenges\test.png'.
  5. Run app.

Link to public reproduction project repository

No response

Version with bug

9.0.111 SR11.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10.0.17763.0

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions