.NET 8 MAUI Desktop App Crashes on Another PC with Microsoft.ui.xaml.dll Exception

Hiroshi Enomoto 0 Reputation points
2024-08-14T22:15:27.6766667+00:00

I have created a Windows desktop application using .NET 8 MAUI. To run the application on another PC, I published it using the following command:

dotnet publish -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true

After copying the publish folder created under the bin directory to another PC and attempting to run the application, the message “.NET Desktop Runtime is required” was displayed. (This was unexpected since I specified WindowsAppSDKSelfContained=true.)

I then had them install the runtime using the following command:

winget install Microsoft.DotNet.DesctopRuntime.8

However, upon running the application again, the following error was logged in the Event Viewer:

Faulting module name: Microsoft.ui.xaml.dll, version: 3.1.5.0, timestamp: 0x7fd76c03 Exception code: 0xc000027b

Could you please advise on what I should check or any potential solutions?
If the issue can be resolved by installing something, I am fine with that.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,542 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 43,371 Reputation points Microsoft Vendor
    2024-08-15T03:07:18.62+00:00

    Hello,

    Maui released Windows Application based on WinUI3 framework. In this case, this may be due to the lack of certain prerequisites in the computer. You can refer to the answer in this thread and the following documentation.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Hiroshi Enomoto 0 Reputation points
    2024-08-29T04:58:00.8566667+00:00

    Hello,

    Sorry for the late response.
    After trying various approaches, I have found a build method that works.

    Not Working:

    dotnet publish -f net8.0-windows10.0.19041.0 -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=
    

    Working:

    dotnet publish --self-contained true -f net8.0-windows10.0.19041.0 -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true
    

    By building with the method shown above, I confirmed that it works on a clean Windows Server 2022 environment. I simply copied the built module without installing the framework.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.