maui: Unable to deploy WinUI App after updating to 8.0.10, 8.0.14, 8.0.20, or installing VS 17.10

Information

It looks like this is a bug in the Windows OS that went out beginning of March related to deploying the WinAppSDK runtime that’s packaged with the WinAppSDK nuget. There is a planned OS update in the near future that will resolve this issue.

Workaround

2 available workarounds

  1. Manually install the runtime that corresponds to the version you are using https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads

    • MAUI 8.0.20+ is 1.5.2
    • MAUI 8.0.10-8.0.14 is 1.4.2
  2. Set the project property in your MAUI app project. Ideally workaround 1 works for you. Disabling the DeploymentManager will cause some features of WinUI to no longer work.

    <PropertyGroup>
        <WindowsAppSdkDeploymentManagerInitialize>false</WindowsAppSdkDeploymentManagerInitialize>
    </PropertyGroup>
    

Description

The program fails to compile after version 8.0.20 of the Microsoft.Maui.Controls and Microsoft.Maui.Controls.Compatibility packages.

Steps to Reproduce

1.Use visual studio 2022 to create a new MAUI project file. 2.Compile and run it on Windows platform, and the program starts normally. image (The Nuget package version used is shown in the figure) image 4.Upgrade the nuget package version to 8.0.20. image 5.Compile the program again and find that the program cannot run normally. image The exception information is as follows: 引发的异常:“System.Runtime.InteropServices.COMException”(位于 WinRT.Runtime.dll 中) WinRT 信息: 找不到元素。

Link to public reproduction project repository

No response

Version with bug

8.0.20 SR4

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

8.0.14 SR3.1

Affected platforms

Windows

Affected platform versions

Windows 11,version 22631.3296

Did you find any workaround?

No response

Relevant log output

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 21 (12 by maintainers)

Commits related to this issue

Most upvoted comments

There may be an issue in Windows App SDK 1.5, so you can do either of these 2 things for now:

Help us debug the issue

  1. get the output of get-appxpackage micro*win*app*run* -allusers from running powershell in admin mode. This will help us determine the root cause.

More info here: microsoft/WindowsAppSDK#4268 (comment)

  1. try installing he latest WASDK that just went out today: https://www.nuget.org/packages/Microsoft.WindowsAppSDK/1.5.240404000

Possible workarounds

  1. Manually install the runtime with the Windows App SDK Runtime Installer x64
  2. Set the project property in your MAUI app project:
    <PropertyGroup>
        <WindowsAppSdkDeploymentManagerInitialize>false</WindowsAppSdkDeploymentManagerInitialize>
    </PropertyGroup>
    

After installing the Windows App SDK Runtime Installer x64 installation package, the project using version 8.0.20nuget package was able to run normally after compilation. I also tried to package it and found that the Dependencies directory was Microsoft. Windows App Runtime. 1.5. msix, while versions 8.0.14 and earlier were Microsoft. Windows App Runtime. 1.4. msix. It is indeed caused by inconsistent versions of Windows App runtime.

This is a screenshot: image