microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.32k stars 676 forks source link

WinUI 3 blank app packaged with WAP project does not start when published #9996

Closed aries-zhang closed 3 weeks ago

aries-zhang commented 3 weeks ago

Describe the bug

WinUI 3 blank app created with the Visual Studio template "Blank App, Packaged with Windows Application Packaging Project (WinUI 3 in Desktop)" does not start when published.

Steps to reproduce the bug

  1. Open Visual Studio 2022
  2. Create a new project with the template "Blank App, Packaged with Windows Application Packaging Project (WinUI 3 in Desktop)" (C#)
  3. Build the solution and get the following error:
    This version of the Windows App SDK requires Microsoft.Windows.SDK.NET.Ref 10.0.19041.38 or later.
    Please update to .NET SDK 6.0.134, 6.0.426, 8.0.109, 8.0.305 or 8.0.402 (or later).
    Or add a temporary Microsoft.Windows.SDK.NET.Ref reference which can be added with:
        <PropertyGroup>
            <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
        </PropertyGroup>
    App5    c:\NUGET_PACKAGES\microsoft.windowsappsdk\1.6.240829007\buildTransitive\Microsoft.WindowsAppSDK.targets 76      
  4. In each pubxml file under "Properties" -> "PublishProfiles", replace win10-x64 with win-x64 to avoid the following error when publishing app package.
    The specified RuntimeIdentifier 'win10-x64' is not recognized. See https://aka.ms/netsdk1083 for more information.  C:\Program Files\dotnet\sdk\8.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets   91      
  5. Add <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion> in the WinUI 3 app project file as the error message suggests.
  6. Right click the WAP project, publish -> Create app packages..
  7. Choose side loading, create a self-signed certificate, trust it, tick x64, Debug(x64) on the next screen, leave everything else as is.
  8. Choose an installer location, click create to create the app package.
  9. Once publish is done, open the app package location, double click the msixbundle file to install the app.
  10. The app should launch if "Launch when ready" is ticked in the installation dialog, or try to launch to app from start menu, the app does not launch.

Expected behavior

The blank app should launch after installed with the published msixbundle package.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.0: 1.6.240829007

Windows version

Windows 11 (22H2): Build 22621

Additional context

Please see projects that reproduces this issue here: https://github.com/aries-zhang/winui3-adventure/tree/main/published-app-crashes

PackagedBlankApp is a blank app project created with the template "Blank App, Packaged (Win UI 3 in Desktop)" which does not have this issue. PackagedBlankAppWithWap is the project created with the template "Blank App, Packaged with Windows Application Packaging Project (WinUI 3 in Desktop)" where this issue occurs.

github-actions[bot] commented 3 weeks ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

aries-zhang commented 3 weeks ago

Closing as VS 17.12 does fix this issue as mentioned here: https://github.com/microsoft/microsoft-ui-xaml/issues/9740#issuecomment-2249083831. However, still having another issue publishing ARM64 app, which is raised separately here: https://github.com/microsoft/microsoft-ui-xaml/issues/9998.