Creating new .NET 6 MAUI project

Viewed 1315

I want to work with MAUI and therefore installed all the necessary stuff (partwise using maui-check).

As given in some tutorials, I now want to create a new Project using dotnet new maui from the command line. But I only get an error message:

No templates found matching:'maui'.
To list installed templates, run 'dotnet new --list'.
To search for the templates on NuGet.org, run 'dotnet new maui --search'.

So why can't I use this command?

2 Answers

It's possible you haven't installed the templates yet. When I did my first maui-check, it said it failed to install the workloads; but subsequent runs supposedly found them. My dotnet new maui would fail with:

PS D:\Development\Technologies\MAUI\test-project> dotnet new maui -n HelloMaui
No templates found matching: 'maui'.
To list installed templates, run 'dotnet new --list'.
To search for the templates on NuGet.org, run 'dotnet new maui --search'.

Then I ran: dotnet new -i Microsoft.Maui.Templates

The following template packages will be installed:
   Microsoft.Maui.Templates

Success: Microsoft.Maui.Templates::6.0.100-preview.6.1003 installed the following templates:
Template Name         Short Name   Language  Tags
--------------------  -----------  --------  ------------------------------------------------
.NET MAUI App         maui         [C#]      MAUI/Android/iOS/macOS/Mac Catalyst/WinUI
.NET MAUI Blazor App  maui-blazor  [C#]      MAUI/Android/iOS/macOS/Mac Catalyst/WinUI/Blazor

And after that I was able to run:

PS D:\Development\Technologies\MAUI\test-project> dotnet new maui
The template ".NET MAUI App" was created successfully.

In the latest version of NET MAUI it allows you to create it as normal: dotnet install maui && dotnet install maui-android && dotnet install maui-ios, or try updating. In case it is the most recent stable version use the command: dotnet workload restore

Related