I just created a Blank App, Packaged (WinUI 3 in Desktop)
project in Visual Studio 2022 with absolutely no added code or external packages that weren't pre-installed and tried to publish it from the command line using dotnet publish
, from the publish menu using ClickOnce, and from the publish menu into a folder. The application publishes successfully and the installers run fine for every one of them (Except for ClickOnce, that just says the app couldn't be installed through the installer message prompt).
However, when I try to run the application, it immediately crashes. In the task manager, I can see the app pop up for a split second, taking up .1MB of ram, and then it disappears.
I've seen other topics related to this on SO and Github but none of them seem to have a solution other than using the Blank App, Packaged with Windows Application Packaging Project (WinUI 3 in Desktop)
project template which I cannot do.
Published WinUI 3 applications need to be signed with a certificate that's trusted on the local machine. Right click project in solution explorer > Publish and Package > Create App Packages. Make sure to create a certificate and trust it on that machine otherwise the app will not run.