.net core - How do I properly publish a Packaged Blank WinUI 3 application? - Stack Overflow

admin2025-04-27  6

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.

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.

Share Improve this question edited Feb 27 at 7:36 Jack J Jun 6,0061 gold badge13 silver badges44 bronze badges asked Jan 10 at 17:23 Alpha ReuelAlpha Reuel 14412 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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.

转载请注明原文地址:http://www.anycun.com/QandA/1745730502a91163.html