Open eerhardt opened 2 years ago
Verified the issue on 17.2.0 Preview 2.1 [32317.152.main], it's repro.
Could be related with https://github.com/dotnet/maui/pull/5923? cc @mattleibow
Not sure... I don't know if there is a way to run WinUI apps from the CLI, either with msbuild or dotnet.
Opened this discussion to be able to find out the way to do things: https://github.com/microsoft/WindowsAppSDK/discussions/2391
Might even be related to this discussion: https://github.com/microsoft/WindowsAppSDK/issues/55
Not sure if there is a way to launch MSIX apps via the CLI, but could be via unpackaged...
Same here. Been doing everything on a Mac so far, where dotnet build -t:Run -f net6.0-maccatalyst
(or -ios, -android, etc.) works fine. Thought I'd try it out on Windows and ran into this issue. It only works if I do a full VS2022 preview install and run from within VS. Seems like it should work on the command line for consistent experience.
Now that the .NET MAUI general availability release has happened, is there any timeline on resolving this issue?
Some Microsoft material released last year indicated that it was perfectly feasible to develop .NET MAUI apps using only VS Code. (Which means you must be able to do it using only vi too... which is my goal... crazy though that may seem!)
To me, this means that there may be a work-around for this issue that the Microsoft insiders have access to. Perhaps it could be posted here as a viable alternative. That is, until the non-VS experience on Windows works out-of-the-box.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
I also see that doing a dotnet build -t:Run -f net6.0-windows10.0.19041.0
on a fresh project does not restore or build. I had to add a separate dotnet build
as well in order for it to do something.
However, I was able to get something to run with unpackaged:
dotnet build /restore -f net6.0-windows10.0.19041.0 /p:WindowsPackageType=None
dotnet build -t:Run -f net6.0-windows10.0.19041.0 /p:WindowsPackageType=None
But we still also need to get dotnet run
working with anything:
The launch profile "(Default)" could not be applied.
A usable launch profile could not be located.
Moving the issue here as well: https://github.com/microsoft/WindowsAppSDK/issues/2922
Not sure if there is a way to launch MSIX apps via the CLI, but could be via unpackaged...
Sure! There's a few
Activation via AUMID:
shell:appsfolder\...aumid...
e.g. ShellExecute("shell:appsfolder\Microsoft.WindowsCalculator_8wekyb3d8bbwe!App") launches Calculator. Try it from the Win-R prompt.
Activation via Executable:
On Win11 if you run a packaged app's exe from its package directory Windows figures out it's a packaged app and runs it e.g. CreateProcess(GetPackagePath(p) + "\foo.exe")
is equivalent to ActivateApplication(fooApplicationUserModelId)
. This is sometimes referred to as PackagedCreateProcess.
NOTE: This requires the executable be declared for only 1 app in the package e.g. you can declare multiple <Application>
in appxmanifest.xml (technically, 0-100) but <Application Executable="foo.exe"...>
must be unique. If 2 <Application>
s declare the same Executable Windows can't launch the app by running its exe. As you might guess, when running the packaged exe Windows does a xref against apps in the package using the exe so 2+ would be ambiguous.
Alternatively on 20H1+, if the executable has a Fusion manifest declaring <msix...>
then you can CreateProcess() the app's exe. CreateProcess sees the manifested identity, does a lookup against packages registered to the user to find the application's details and voila! This is equivalent to PackagedCreateProcess, though it requires <msix>
(on the upside, it predates PackagedCreateProcess so available further downlevel). See https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests#msix. NOTE: The docs talk about sparse MSIX packages; that's a scenario where this is useful, but <msix>
is a mechanism, it doesn't care about WHY you use it - you can use <msix>
whether or not you have a sparse package.
NOTE: Running an executable by typing it into a command line invokes CreateProcess (or ShellExecute, depending on the command prompt). These are options you can use to interactively launch MSIX packaged apps. Programmatically there's additional options.
I think the issue I raised here on SO is similar.
Verified this issue with Visual Studio 17.6.0 Preview 2.0. Repro on Windows application from command line.
Still an issue in 2024 btw
This is still blocked on https://github.com/microsoft/microsoft-ui-xaml/issues/7331 and other related issues. Thank you for your patience!
Still an issue today.
How do you actually build/run a maui app on windows then? I only use VSCode.
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=None
and for run
dotnet run -f net8.0-windows10.0.19041.0 -c Debug -p:PublishReadyToRun=true -p:WindowsPackageType=None
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 thatdotnet run -f net6.0-windows10.0.19041.0
also doesn't work.cc @mattleibow
Steps to Reproduce
dotnet new maui
dotnet build -t:Run -f net6.0-windows10.0.19041.0
Results
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
Depends on