Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
whiskhub opened this issue Jan 17, 2025 · 0 comments
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners

Comments

@whiskhub
Copy link
Contributor

whiskhub commented Jan 17, 2025

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

  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 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.

@whiskhub whiskhub added the bug Something isn't working label Jan 17, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners
Projects
None yet
Development

No branches or pull requests

1 participant