Unable to run Windows application from .NET SDK command line
Describe the bug
See more details in https://github.com/dotnet/maui/issues/5975
We should be able to run a windows app with dotnet run or dotnet build -t:Run at the very least.
Steps to reproduce the bug
- New WinUI app using net6+
-
dotnet run
Expected behavior
App launches (for both packaged and unpackaged)
Screenshots
No response
NuGet package version
1.1.4
Packaging type
No response
Windows version
No response
IDE
Other
Additional context
No response
There are ways to launch packaged apps from the command line. See https://github.com/dotnet/maui/issues/5975#issuecomment-1234510397
If you're looking to run dotnet.exe and have it launch your app (and that doesn't happen today) that's a .NET issue you should discuss further with the .NET team (e.g. via that MAUI issue thread). Windows has APIs to programmatically launch packaged apps but it would be up to dotnet.exe to call them.
Did @DrusTheAxe's suggestion resolve this issue?
The first step might be to follow several other workloads and make a "Run" target that the dotnet run CLI can use. Having the core sdk know about all the different permutations of different apps might not be that feasable.
So having each framework do the thing, and the core SDK just execute it is probably better - and run may also need a build so a Run depends on Build is super easy.
But as of today, we have nothing. So a Run target is going to be very helpful.
I think the issue I raised here on SO is similar.
It appears if you build and then run an unpackaged app it works a bit better: https://github.com/dotnet/maui/issues/13942
Tracking this internally as well: https://dev.azure.com/microsoft/OS/_workitems/edit/44573471
Still an issue, just fyi.