-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Default MAUI project cannot be launched for Windows #6111
Comments
verified not repro on VS 17.2.0 preview 2.1 [32317.152] with MAUI project. |
The first error here is that Visual Studio shows every target framework for this page, even though it should only show Windows. That's why you see the errors. I believe that's a Roslyn bug that should be fixed in 17.3 Preview 1. It's irrelevant to your issue here. The thing is, it should still compile though, since it's not actually a build error. Your issue is that the WinUI DLL is not being added as output to your project, so it's blowing up. I would see if you can try building a straight WinUI app and see if that works, or maybe try adding a direct reference to the WindowsAppSDK (https://www.nuget.org/packages/Microsoft.WindowsAppSDK)? |
I'm having the same issue, so far nothing has worked... |
Hi @holecekp. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
I have found some time and uploaded a repro project to Github: The repro project is just a blank MAUI app created by Visual Studio using the default template. So this is what everyone gets when selecting New > MAUI APP (preview) in VS 2022 preview 3. I did not make any changes! All this code has been generated by Visual Studio. Select "Windows Machine" as a target and launch it. It crashes immediately. |
Got your exact code, ran it and it works fine. It must be something in your setup. Could you maybe check if you have the C++ Redistributable package installed? And if not, install that? And as @drasticactions suggested, check if a WinUI app works without .NET MAUI. Together with that you might want to check if the WinUI workload was installed. One of the prerequisites isn't right. Closing this for now as being an official bug on our side, feel free to let us know what you find. Thanks! |
The problem was in the version of Visual C++ Redistributable. I had version 2017 installed on my computer and the MAUI app crashes with it. As soon as I have installed version "2015-2022" the problem disappeared and MAUI app runs fine on Windows. Thank you for your help. So this is a problem of the preview version of Visual Studio. The correct behavior would be that all dependencies (including Visual C++ Redistributable 2015-2022) should be installed automatically when MAUI workload is installed, or the VS should at least warn the user that an important component is missing. |
My guess is that you don't have the WinUI workload installed either, which probably contains that dependency, where MAUI itself does not. I would file that to VS then https://developercommunity.visualstudio.com/home |
Description
I have downloaded Visual Studio 17.2.0 Preview 3.0 and created a new MAUI application using the default template in VS. I did not modified anything. I have just pressed F5. However, the solution cannot be compiled for Windows. Several errors are shown:
I have switched the target to Android, launched the app and it can be compiled and it runs fine.
Then, I have switched to Windows again. This time the app can be compiled but it crashes right after the start. The following error is shown:
Steps to Reproduce
Version with bug
Release Candidate 1 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows 10 (21H2, build 19044.1645)
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: