microsoft / microsoft/WindowsAppSDK

XBF files are copied to MSIX even though already embedded in PRI file when referencing library project

Open
#6,605 0 comments 0 reactions 0 assignees View on GitHub
area-MSIXBuildTools needs-triage
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

Bug in the MSIX tooling: 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:

```xml







[Embedded Binary Data]




[Embedded Binary Data]


```

### Steps to reproduce the bug

Simple repro: https://github.com/whiskhub/WinUI3_Xbf_Repro

1. Create blank WinUI 3 app
2. Add blank WinUI 3 class library project to the solution
3. Reference the library in the main app
4. Add XAML files to the library project
5. Build and compile the app
6. In Visual Studio, select "Release" configuration
7. In Visual Studio, use _Package and Publish -> Create App Packages..._ to create a MSIX package for sideloading
8. 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 or *.xaml files in the MSIX output, as they are embedded in the .pri file already.

### Screenshots

_No response_

### NuGet package version

2.2.0

### Packaging type

Packaged (MSIX)

### Windows version

Insider Build (xxxxx)

### IDE

_No response_

### Additional context

Specifying `false` did not make any difference.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the WinUI3_Xbf_Repro linked in the issue and reproduce the Release MSIX packaging flow. Compare the ClassLibrary1.pri contents with the generated package, then trace the MSIX tooling input that copies the XBF files. Done means embedded XBFs are not emitted as separate files in the package.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.