-
Notifications
You must be signed in to change notification settings - Fork 802
Description
Describe the bug
When referencing a WinUI 3 class library containing XAML files in a WinUI 3 app, the resulting binary XAML files (xbf) are being packaged in the MSIX package, even though the files are already embedded in the pri file of the class library:
└── WinUI3_Xbf_Repro/
├── AppxBlockMap.xml
├── AppxManifest.xml
├── ClassLibrary1.dll
├── ClassLibrary1.pri <--- already embeds XBFs
├── resources.pri
├── WinUI3_Xbf_Repro.dll
├── WinUI3_Xbf_Repro.exe
├── ...
└── ClassLibrary1/
├── ResourceDictionary1.xbf <--- unnecessary
├── ResourceDictionary2.xbf <--- unnecessary
└── ...
This causes unnecessary files in the MSIX, slowing down installation. Also, the entire folder structure and file paths of XAML files are easily visible for the basic user, which is undesirable. (It's clear that the app can be decompiled easily anyways).
Calling makepri.exe dump /if ClassLibrary1.pri also confirms the xbf files are really embedded:
<PriInfo>
<ResourceMap name="ClassLibrary1" version="1.0" primary="true">
<Qualifiers/>
<ResourceMapSubtree name="Files">
<ResourceMapSubtree name="ClassLibrary1">
<NamedResource name="ResourceDictionary1.xbf" uri="ms-resource://ClassLibrary1/Files/ClassLibrary1/ResourceDictionary1.xbf">
<Candidate type="EmbeddedData">
<Base64Value>[Embedded Binary Data]</Base64Value>
</Candidate>
</NamedResource>
<NamedResource name="ResourceDictionary2.xbf" uri="ms-resource://ClassLibrary1/Files/ClassLibrary1/ResourceDictionary2.xbf">
<Candidate type="EmbeddedData">
<Base64Value>[Embedded Binary Data]</Base64Value>
</Candidate>
</NamedResource>Steps to reproduce the bug
Simple repro: https://github.com/whiskhub/WinUI3_Xbf_Repro
- Create blank WinUI 3 app
- Add blank WinUI 3 class library project to the solution
- Reference the library in the main app
- Add XAML files to the library project
- Build and compile the app
- In Visual Studio, select "Release" configuration
- In Visual Studio, use Package and Publish -> Create App Packages... to create a MSIX package for sideloading
- Sideload the MSIX file OR simply open it in a ZIP file viewer
The MSIX will contain a subfolder "ClassLibrary1" with a .xbf file for each XAML file in code. The MSIX will also contain a ClassLibrary1.pri file, which already contains the *.xbf file contents embedded.
Expected behavior
There are no *.xbf files in the MSIX output, as they are embedded in the .pri file already.
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003
Windows version
Windows 11 (24H2): Build 26100
Additional context
Specifying <DisableEmbeddedXbf>false</DisableEmbeddedXbf> did not make any difference.