dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.04k stars 1.73k forks source link

Visual Studio 2022 not installing MAUI properly, cannot find MAUI workload, project unloaded #15100

Closed asheroto closed 6 months ago

asheroto commented 1 year ago

Description

I have Visual Studio 2022. I added the .NET Multi-platform App UI Development but did not see any project templates.

image

I was able to add them using dotnet workload install maui. I then created a project using the .NET Maui App template but VS doesn't look right, it says "project unloaded" and "Attached" at the top and appears as such...

image

It was recommended to try Visual Studio 2022 Preview so I installed that but that didn't help. I then uninstalled Visual Studio 2022 Preview and began using Visual Studio 2022 again. Still had issues.

Per #1473, I tried running but maui-check fails with... image

The items above that succeed and are in green, but those items failed and are in red.

Also per #1473, I tried running dotnet workload install maui again with Visual Studio 2022 but it failed with... image

Also per #1473, I have tried uninstalling and reinstalling this extension. This did not fix the problem either.

I also tried creating a global.json file and forcing the SDK version to 6.0.408 and then running dotnet workload install maui but still got the same error. It appears to happen despite the SDK version number specified or without specifying.

Full maui-check output... image

Tapping y then Enter to force CLI fixes does not resolve either. Note that the first time I ran maui-check it was also missing components under Android SDK Checkup but it was able to resolve those issues.

Using dotnet workload search maui returns no results... image

Running dotnet new --install Microsoft.Maui.Templates appears to work at first... image

But still fails under maui-check... image

It was also recommended to remove items in C:\Program Files\dotnet\metadata\workloads and re-run the above commands, but this did not help and I restored the files.

Finally, I fully removed Visual Studio 2022 and reinstalled it, but am still facing the exact same issue.

For reference, here is the output of dotnet --list-sdks... image

At least when I tried it, there's something wrong with Visual Studio 2022 in that it does not set up MAUI properly. Visual Studio 2022 Preview didn't help either.

I appreciate your time and effort in solving this issue!

Steps to Reproduce

  1. Visual Studio 2022 already installed
  2. Added workload .NET Multi-platform App UI Development
  3. MAUI templates missing
  4. maui-check fails
  5. dotnet workload install maui cannot find workload
  6. dotnet new --install Microsoft.Maui.Templates appears to work but doesn't
  7. Tried using Visual Studio 2022 Preview and re-ran the commands above but no change
  8. See details in description area

Link to public reproduction project repository

N/A

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 11 Pro

Did you find any workaround?

No

Relevant log output

> OpenJDK 11.0 Checkup...
  - 11.0.16.1 (C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin\..)

> Visual Studio 17.3.0-pre.2.0 Checkup...
  - 17.5.5 - C:\Program Files\Microsoft Visual Studio\2022\Enterprise

> Android SDK Checkup...
  - emulator (32.1.12)
  - build-tools;31.0.0 (31.0.0)
  - platforms;android-31 (1)
  - system-images;android-31;google_apis;x86_64 (13)
  - platform-tools (34.0.1)
  - cmdline-tools;5.0 (5.0)

> Android Emulator Checkup...
  - Emulator: Android_Emulator_31 found.

> .NET SDK Checkup...
  - 6.0.116 - C:\Program Files\dotnet\sdk\6.0.116
  - 6.0.203 - C:\Program Files\dotnet\sdk\6.0.203
  - 6.0.311 - C:\Program Files\dotnet\sdk\6.0.311
  - 6.0.400 - C:\Program Files\dotnet\sdk\6.0.400
  - 6.0.408 - C:\Program Files\dotnet\sdk\6.0.408
  - 7.0.203 - C:\Program Files\dotnet\sdk\7.0.203

> .NET SDK - Workload Deduplication Checkup...

> Edge WebView2 Checkup...
  - Found Edge WebView2 version 113.0.1774.42

> .NET SDK - Workloads (6.0.301) Checkup...
  x android (Microsoft.NET.Sdk.Android.Manifest-6.0.300 : 32.0.440) not installed.
  x ios (Microsoft.NET.Sdk.iOS.Manifest-6.0.300 : 16.4.47) not installed.
  x maccatalyst (Microsoft.NET.Sdk.MacCatalyst.Manifest-6.0.400 : 16.4.47) not installed.
  x tvos (Microsoft.NET.Sdk.tvOS.Manifest-6.0.400 : 16.4.47) not installed.
  x macos (Microsoft.NET.Sdk.macOS.Manifest-6.0.400 : 13.3.47) not installed.
  x maui (Microsoft.NET.Sdk.Maui.Manifest-6.0.300 : 6.0.419) not installed.
! Managing Workload installation from the CLI is NOT recommended.  Instead you should install the latest Visual Studio
preview to automatically get the newest release of .NET MAUI workloads installed.
paulojl commented 1 year ago

If you install the latest .net sdk 8.0.preview 4, you will be able to manually install the .net maui workload but only versions 7 and 8.

tinhmdxdev commented 1 year ago

I got the same issue I try to clean all and reinstall them, but I got some problems: First, the dotnet SDK install with Visual Studio was not installed normally, I run "dotnet --version" and get nothing. Then, I try to install the standard alone dotnet sdk package, and repair, and I can run "dotnet --version". Second, I try to install maui workload "dotnet workload install maui", and it returns "Workload ID mau is not recognized"

What's happened with maui workload? My deadline is coming. This is really annoying!

asheroto commented 1 year ago

I wonder how many people are experiencing the issue and cannot use MAUI because of this.

pdinbkk commented 11 months ago

Same issue with VS2022 17.7.6. Uninstalled, cleaned up old dirs, then re-installed. No MAUI.

Sanifant commented 11 months ago

Same issue here with VS2022 17.7.6 Community Edition.

ghost commented 11 months ago

Thanks for the issue report @asheroto! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or Visual Studio for Mac feedback tool to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.
ZepedaJake commented 10 months ago

Was having this issue. Played with MAUI in the past and wanted to revisit but could not get it work, getting same errors shown above. Updated VS 2022 to 17.8 just now and it is working again.

jfversluis commented 6 months ago

This is pretty old by now, seems resolved and is probably VS/tooling related. Closing this here.