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.15k stars 1.74k forks source link

MAUI Templates are missing in VS 2022 17.3.0 Preview 1.1 #7819

Closed nZeus closed 2 years ago

nZeus commented 2 years ago

Description

Installed the VS 17.3.0 Preview 1.1, and I cannot create a MAUI project anymore.

image

Steps to Reproduce

  1. Install Visual Studio 2022 17.3 Preview 1.1
  2. Start new Project
  3. Drop down for Project Type doesn't include Maui
  4. Open Console
  5. Type "dotnet new --list" to see list of templates
  6. Notice it is missing.

image

image

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

Windows 11 Pro 22H2 22621.1

Did you find any workaround?

no

Relevant log output

No response

Symbai commented 2 years ago

MAUI is incompatible with .NET 7 so you might want to uninstall it. Got the same VS version and I got all the MAUI templates.

image

image

image

nZeus commented 2 years ago

Thank you @Symbai , I think you're right.

If I add a global.json file and run dotnet new --list, then I see MAUI templates in the list: image

But I still cannot add MAUI projects in Visual Studio, only through the cli.

I would say that the issue is that Visual Studio doesn't show all the templates, from all the SDKs.

Symbai commented 2 years ago

MAUI wants 6.0.300 and cause unpredictable problems when you have a newer .NET version / SDK installed. I suggest you uninstall that first as I told you and then check it again.

ghost commented 2 years ago

Hi @nZeus. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. 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.

mprogers commented 2 years ago

I have the same problem. I'm running Windows 11 on a Mac Studio, I dunno if that's the problem?

dotnet --version 6.0.300

When I look in Visual Studio 2022 Preview (17.3.0, 1.1) and search in templates for MAUI, or when I run dotnet new --list, I don't see anything about MAUI:

Template Name Short Name Language Tags


ASP.NET Core Empty web [C#],F# Web/Empty ASP.NET Core gRPC Service grpc [C#] Web/gRPC ASP.NET Core Web API webapi [C#],F# Web/WebAPI ASP.NET Core Web App webapp,razor [C#] Web/MVC/Razor Pages ASP.NET Core Web App (Model-View-Controller) mvc [C#],F# Web/MVC ASP.NET Core with Angular angular [C#] Web/MVC/SPA ASP.NET Core with React.js react [C#] Web/MVC/SPA Blazor Server App blazorserver [C#] Web/Blazor Blazor WebAssembly App blazorwasm [C#] Web/Blazor/WebAssembly/PWA Class Library classlib [C#],F#,VB Common/Library Console App console [C#],F#,VB Common/Console dotnet gitignore file gitignore Config Dotnet local tool manifest file tool-manifest Config EditorConfig file editorconfig Config global.json file globaljson Config MSTest Test Project mstest [C#],F#,VB Test/MSTest MVC ViewImports viewimports [C#] Web/ASP.NET MVC ViewStart viewstart [C#] Web/ASP.NET NuGet Config nugetconfig Config NUnit 3 Test Item nunit-test [C#],F#,VB Test/NUnit NUnit 3 Test Project nunit [C#],F#,VB Test/NUnit Protocol Buffer File proto Web/gRPC Razor Class Library razorclasslib [C#] Web/Razor/Library Razor Component razorcomponent [C#] Web/ASP.NET Razor Page page [C#] Web/ASP.NET Solution File sln Solution Web Config webconfig Config Windows Forms App winforms [C#],VB Common/WinForms Windows Forms Class Library winformslib [C#],VB Common/WinForms Windows Forms Control Library winformscontrollib [C#],VB Common/WinForms Worker Service worker [C#],F# Common/Worker/Web WPF Application wpf [C#],VB Common/WPF WPF Class Library wpflib [C#],VB Common/WPF WPF Custom Control Library wpfcustomcontrollib [C#],VB Common/WPF WPF User Control Library wpfusercontrollib [C#],VB Common/WPF xUnit Test Project xunit [C#],F#,VB Test/xUnit

I'm trying to prep this summer for a class that I'm teaching in the fall, so any help would be greatly appreciated!

jfversluis commented 2 years ago

You might want to check it .NET 7 preview is installed (run dotnet --version), if that's the case the templates are installed but they won't show up. More info on that here.

If the templates are not installed you can run dotnet new -i Microsoft.Maui.Templates to still get them. Please do not use the version that is at the end, especially not the one as advertized here because that is an older version. If you do not specify a version the newest ones will be installed.

We're investigating why the templates are not installed in some instances and will fix that. Since we have multiple issues about this I'm closing this one. Please let us know if you still can't get the templates to show up.

@mprogers I hope this helps, if not, feel free to reach out to me directly so we can start helping that prep! We don't want to leave the students out in the cold!

nZeus commented 2 years ago

Indeed that was my problem - I had preview 7 installed. It is very nice that you have that wiki page, thanks a lot!

I agree, the issue can be closed

mprogers commented 2 years ago

Well ... now I can see templates in Visual Studio, but building a project produces a slew of errors about target platform identifiers not being recognized (android, maccatalyst, iOS ), and something about the Platform version not present.

Error | NETSDK1139 | The target platform identifier android was not recognized. | MauiApp1 | C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets | 112 |  

Error | NU1012 | 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 | MauiApp1 |

I am running this on Windows 11 over Parallels (for macOS), so maybe that's the problem. Interestingly, the Mac version of this worked fine, and on my office computer (Intel-based Mac running Windows 10) this isn't an issue.

I'm sure this is just something simple that I've neglected to do -- I do most of my development in Swift and Flutter -- so any suggestions (apart from give up and wait a year for it to come out of beta, I did that last year) would be appreciated!