gpt4 book ai didi

c# - 创建新的 .NET 6 MAUI 项目

转载 作者:行者123 更新时间:2023-12-05 00:44:03 27 4
gpt4 key购买 nike

我想使用 MAUI,因此安装了所有必要的东西(部分使用 maui-check)。

正如一些教程中给出的,我现在想从命令行使用 dotnet new maui 创建一个新项目。但我只收到一条错误消息:

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'.

那为什么我不能使用这个命令呢?

最佳答案

您可能尚未安装模板。当我第一次执行 maui-check 时,它说安装工作负载失败;但随后的运行据说找到了它们。我的 dotnet new maui 会失败:

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'.

然后我运行: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

然后我就可以跑了:

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

关于c# - 创建新的 .NET 6 MAUI 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68456322/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com