maui: No Maui Project Template and error: Platform version is not present for one or more target frameworks

Description

I seem to have messed up my MAUI installation on Windows VS2022 17.2.0 Preview 2.1.

I cannot see the MAUI template when creating a new project.

When opening an existing MAUI project I see the following error: Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-android, net6.0-ios, net6.0-maccatalyst

Running dotnet workload list gives me the following:

>dotnet workload list

Installed Workload Ids      Installation Source
-----------------------------------------------
maui-windows                VS 17.2.32317.152
maui-maccatalyst            VS 17.2.32317.152
maccatalyst                 VS 17.2.32317.152
maui-ios                    VS 17.2.32317.152
ios                         VS 17.2.32317.152
maui-android                VS 17.2.32317.152
android                     VS 17.2.32317.152

Repairing my VS2022 installation did not fix this, and uninstalling & reinstalling did not fix this either.

Opening the same projects on a different computer with the same VS2022 version works fine

Steps to Reproduce

This issue happens consistently for me but I cannot reproduce it on a different machine.

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

net6.0-windows10.0.19041;net6.0-android;net6.0-ios;net6.0-maccatalyst

Did you find any workaround?

No response

Relevant log output

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 17 (7 by maintainers)

Most upvoted comments

Can confirm that adding global.json with net6 to solution’s root fixes it (I also have net7-preview installed, and it seems like it messes maui up)

My global.json:

{
  "sdk": {
    "version": "6.0.300-preview.22204.3"
  }
}

PS: Latest preview didn’t fix it, I still need global.json

Thanks for being on top of this @nukedbit ! More people seeing this is resolved with the latest release?