-
Notifications
You must be signed in to change notification settings - Fork 408
Open
Labels
Description
Describe the bug
When WindowsAppSDKSelfContained is enabled in a library project, it causes a codegen error in WinUI (XAML).
Steps to reproduce the bug
- Clone https://github.com/dongle-the-gadget/WinUISelfCrash and open WinUISelfCrash.slnx
- Run the main app project (WinUISelfCrash), observe that it runs as normal with a "Hello world" button in the middle
- Close the app, clean the solution, and set
WindowsAppSDKSelfContainedto true in the WinUISelfCrashLib (Library) project - Run the app again, observe Microsoft.UI.Xaml.Markup.XamlParseException: 'XAML parsing failed.'
- Delete
WindowsAppSDKSelfContainedfrom the library project and clean the solution once more. - Open up a command line and navigate it to the repository.
- Run
dotnet msbuild /p:Platform=[platform] /p:WindowsAppSDKSelfContained=true, replacing[platform]with your machine's architecture. - Run the app and see that it fails to launch (briefly hanging with waiting cursor before turning back to normal)
Expected behavior
The app should launch normally regardless of whether WindowsAppSDKSelfContained is set to true in the library project.
Screenshots
No response
NuGet package version
Windows App SDK 1.8.3: 1.8.251106002
Packaging type
Unpackaged
Windows version
Insider Build (xxxxx)
IDE
No response
Additional context
This is caused by _OverrideGetPriIndexName in Microsoft.WindowsAppSDK.SelfContained.targets file in Microsoft.WindowsAppSDK.Base NuGet, which doesn't check if it's in a library, and hence will set the PRI root to empty (which should be used for apps and not libraries)
riverar and DrusTheAxe