Skip to content

Copy font assets only works at second build #23268

@AlleSchonWeg

Description

@AlleSchonWeg

Description

I wondered, why me IconFont was not working in release mode. The font is in Resources\Fonts\ folder referenced in .csproj:

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

I builded the app and deployed it to the simulator but no icon was shown. Hmm, in debug mode it works. So i looked in the obj folder. In Debug\net8.0-android\assets my ttf file was shown. In Release\net8.0-android\assets was no ttf file:
image
I started deleting obj/bin folders and rebuild. On the first build the assets folder keeps empty but with the second build the folder contains the ttf files and my icon font starts working in release mode:
image

The screenshots shows the default MAUI App with the included fonts. The behavior is the same.

Steps to Reproduce

  1. Create App from VS template
  2. Delete obj/bin folders
  3. Build Release and look at the assets folder --> folder emty
  4. Build again. Folder not empty

Link to public reproduction project repository

No response

Version with bug

8.0.60 SR6

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-fontsCustom fonts and Font related API'sarea-single-projectSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizerp/1Work that is important, and has been scheduled for release in this or an upcoming sprintplatform/androids/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions