microsoft-ui-xaml: Self contained, WindowsPackageType none, Single file published winui3 app is not launching

Describe the bug

I spend hours trying to make it work but basically Self-contained, WindowsPackageType none, Single file published winui3 exe file are crashing.

<WindowsPackageType>None</WindowsPackageType>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>

This is the error I get when i start the exe in visual studio in debug mode. Exception non gérée à 0x756A8984 (KernelBase.dll) dans App1.exe : 0xE0434352 (paramètres : 0x80131524, 0x00000000, 0x00000000, 0x00000000, 0x00540000). (you can see that at the end of the video)

Steps to reproduce the bug

https://github.com/microsoft/microsoft-ui-xaml/assets/80718477/322429d6-0dd0-47a7-a9b8-e8e8ad2c3d0e

Expected behavior

The app should launch

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5.4: 1.5.240607001

Windows version

Windows Insider Build (xxxxx)

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

I did the following steps:

-Create the new project -Add TrimMode=partial, WindowsPackageType=None and WindowsAppSdkSelfContained=true setting to the csproj. -Open the publish profile for the architecture and change PublishSingleFile to true. -I also had to change win10-platform to win-platform in the publish profile. Somehow the .net version detection does not seem to work when publishing from visual studio which results in an error -The app should now publish, but crashes during startup -Delete the obj and bin folder -Publish again -App now starts