-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Can't run published WinUI app. #1557
Comments
Same Problem here. I can run the project in Visual Studio 2019 Preview without any problems. But as soon as i build the executable and launch it, i get the same crash report in the windows event viewer. .NET SDK Runtime: Host (useful for support): .NET SDKs installed: .NET runtimes installed: |
There appear to be a few limitations to MAUI on Windows, caused by the use of WinUI 3 as the host. Publishing is definitely one of those. I think the answer to your problem might be that you have limited publishing options available because of the host being WinUI 3. I've created a test application from the maui-blazor template and tried to publish it using Visual Studio. Here is the outcome of the ways I have tried:
Publishing is definitely going to need some work for MAUI before launch, because the state of play at the moment isn't workable. However, we're in preview, and I completely understand that we should expect these bumps in the road at the moment, as making MAUI function at all has to come first! Sidenote: the reason I was trying this is because I have found a permissions issue with running an application built with the experimental Mobile Blazor Bindings framework (a forerunner to MAUI using Blazor) when installed in the "Program Files" or "Program Files (x86)" folders. This is caused by the way the WebView2 component is initialised; by default WebView2 uses the application folder to store temporary files and this won't work in the folders mentioned, as they are read-only to the application - they are not suitable locations for temporary files. As soon as we have a way to publish, we need to test whether we can install an application and have it work using WebView2. |
In the previous iteration using Xamarin Forms, WPF was used as the host for Windows. That was much simpler; it's more comfortable for .NET developers, as it more completely falls within the .NET space that we are used to working in. WinUI 3 is not, and I think it will be a lot more painful for developers not used to WinUI (or UWP before it perhaps.) I wonder if it's worth making WPF available as a host type in MAUI as well as WinUI. I think the use of WinUI 3 is going to cause a lot of friction. That might have a very negative impact on what otherwise promises to be a great technology - possibly to the point where a generation of developers are put off using it because of bad experiences that are nothing to do with MAUI itself. |
Could you try with the latest Preview and Visual Studio 2022? |
Yes, absolutely. Were you wanting us to test with .NET MAUI Preview 9 (out now) or Preview 10? Preview 10 is due in a few days, I believe. |
Preview 9 ClickOnce deployment does the same thing I detailed above - I run setup.exe and it installs, but when I try to run it it shows a dialog asking if I want to install the runtime, despite the runtime already being installed. Setup: Framework-dependent, target runtime: portable, x64 .NET 6 RC2 set as a prerequisite |
Same thing if I change the target runtime to win-x64; a dialog shows saying "To run this application, you must install missing frameworks for .NET". Same machine being used for the build, publish and installation. I can confirm I do have the x64 RC2 runtime already installed, so this prompt doesn't make any sense as far as I am concerned. I've not tried clicking Yes because I don't know what it's going to try to do, and I don't want anything else installed on this machine. |
i have the same problem for a long time. |
Visual Studio 2022 17.1.0 Preview 1 with .NET 6 and .NET MAUI Preview 10 doesn't work either. ClickOnce has been removed, so I have attempted to publish to a folder for Windows, and that fails with the error: RuntimeIdentifier 'win-x64' is invalid. Publish Settings: I've tried win-x86 as well, that also fails. |
Running into a similar error. Debugging in VS works fine, but when attempting to run a generated build from outside of VS, the application fails to open. Crash message in Event Log says: Windows x64, Debug:
Here are my project settings:
I tried both normally and single file; neither work. Tried x64 and any cpu; neither work. Doesn't run on my machine or a virtual machine running Windows Server. |
I ran into the same issue. Is there any fix yet? |
I found a workaround with a lot of trouble and testing. (for running in windows, I tried to publish see settings and results below) There is some confusion on what to install because it is different for different versions of VS and MAUI. I installed optional components: Then after i created my app i opened the project file (fist tried in properties but without knowing what framework to use it is not helpful) Then on the debug dropdown you need to change the framework to the windows one and select windows machine as the debug device. On trying to publish, i selected a folder to publish to as this is the simplest option. So after creating the profile, i clicked on show all setting and set the target framework to the windows option, if the deployment mode is framework dependent (correct version of .net is installed on machine) i can select portable for target runtime and the publish succeeds. When i tried to run it i get a warning that i need .net runtime, since it is my dev machine it is already installed, but maybe not for running outside of vs / dotnet run, but i did not want to install additional .net runtimes when most things is working how i like it If i change the deployment mode to self contained the portable option is not available (it includes a specific version of .net) and the win64 and win x86 still did not work This is my experience so far and i hope it helps someone. |
环境 调试 Blazor MAUI 在 VS2022 中运行正常。 发布单文件时,我遇到了问题,怎么解决? —————————————————————————————————————————————
—————————————————————————————————————————————
—————————————————————————————————————————————
—————————————————————————————————————————————
————————————————————————————————————————————— |
Issue is still there in Maui Preview 11 (with Microsoft Visual Studio Professional 2022 (64-bit) - Preview dotnet publish -c:Release -f:net6.0-windows10.0.19041 -o d:\tmp. Error Message is: C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1005: Assets file 'C:\Users\me\source\myapp\myapp\obj\project.assets.json' doesn't have a target for 'net6.0-windows10.0.19041'. Ensure that restore has run and that you have included 'net6.0-windows10.0.19041' in the TargetFrameworks for your project. |
Hey everyone! I've been trying to look into this and wrote up all my findings in #4329. In an attempt to not be all over the place with this I'm closing this one, let's centralise the discussion in the aforementioned issue, thanks! |
How to reproduce:
Create a new MAUI project (VS 16.11.0 preview 2)
Debug => Runs fine
Publish => Running the published app Starts then exits with following error (from event viewer)
The text was updated successfully, but these errors were encountered: