maui: Unable to run Windows application from command line
Description
I am unable to launch my Maui Windows application from the command line. With Android I can with dotnet build -t:Run. But this doesn’t work with Windows. Note that dotnet run -f net6.0-windows10.0.19041.0 also doesn’t work.
cc @mattleibow
Steps to Reproduce
dotnet new mauidotnet build -t:Run -f net6.0-windows10.0.19041.0
Results
C:\git\maui\bin\dotnet\sdk\6.0.300-preview.22207.16\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(901,5): er
ror MSB3073: The command "C:\DotNetTest\MauiTest\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\MauiTest.exe " exited w
ith code -532462766. [C:\DotNetTest\MauiTest\MauiTest.csproj]
Version with bug
Unknown/Other (please specify)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
All Windows
Did you find any workaround?
No response
Relevant log output
When attaching a Debugger to the process, I see:
System.DllNotFoundException
HResult=0x80131524
Message=Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
Source=MauiTest
StackTrace:
at MauiTest.WinUI.Program.XamlCheckProcessRequirements()
at MauiTest.WinUI.Program.Main(String[] args) in C:\DotNetTest\MauiTest\obj\Debug\net6.0-windows10.0.19041.0\win10-x64\Platforms\Windows\App.g.i.cs:line 28
Depends on
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 9
- Comments: 19 (8 by maintainers)
Still an issue in 2024 btw
I also see that doing a
dotnet build -t:Run -f net6.0-windows10.0.19041.0on a fresh project does not restore or build. I had to add a separatedotnet buildas well in order for it to do something.However, I was able to get something to run with unpackaged:
But we still also need to get
dotnet runworking with anything:i use the following for running the windows application. build
dotnet build -f net8.0-windows10.0.19041.0 -c Debug -p:PublishReadyToRun=true -p:WindowsPackageType=Noneand for rundotnet run -f net8.0-windows10.0.19041.0 -c Debug -p:PublishReadyToRun=true -p:WindowsPackageType=Nonedotnet run -f net8.0-windows10.0.19041.0 -c Debug -p:PublishReadyToRun=true -p:WindowsPackageType=NoneWorks for me too, thanks @sdheer !
Still an issue today.