Launching MAUI application from command line

Fabrice Leal 61 Reputation points

I'm having some trouble launching a MAUI application from the command line, using dotnet build -t:RUN seems to crash with some Microsoft.ui.xaml.dll error, launching the executable directly creates the process but it quickly finishes, and executing dotnet run with an Executable profile yields yet another error.


A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,057 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 70,646 Reputation points Microsoft Vendor


    I run your donet CLI, I get the same errors.

    I find a similar thread: .NET MAUI on Windows without Visual Studio - How to make it work? - Microsoft Q&A

    Here is a workaround.
    You can use msbuild command line to build your maui project for windows.

       msbuild -r -p:Configuration=Release -p:RestorePackages=false -p:TargetFramework=net6.0-windows10.0.19041  

    Best Regards,

    Leon Lu

    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.