visual-studiowinui-3winuiwindows-app-sdk

WinUI 3 default template not working when using publish


Im playing around with Winui3 for my next app. I created a default project from the Blank app, Packaged (winui3 in desktop) template in visual studio 2022.

When i run the application inside visual studio with the play button, it works. I want to now generate a stand alone .exe file to run the application. To do this i created a self-contained application through the publish option in visual studio that output the following three files: myapp.pri, myapp.exe and myapp.pdb.

But.. when i double click that published myapp.exe file, nothing happens. Just a spinning icon next to my cursor and nothing. No error.

When i first tried publish, it gave me an error. A google told me to edit the .csproj visual studio file and ammend the runtimeidentifier property and drop off the -10 tags on the end of them, which i did. that fixed the publish errors. Apart from this, i have not done anything.

*target framework is .NET 8.0, windows, target OS version 10.0.19041.0, releae, x64.

What am i missing?


Solution

  • Some tips about publishing a single file:

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

    Profile settings dialog