Dot-Net

創建第一個 .Net MAUI 項目

  • February 19, 2022

我嘗試使用 Visual Studio 開發人員命令提示符在 Windows 中創建 Maui 項目

Command :

dotnet new maui

但它沒有創建 Maui 項目,收到錯誤消息沒有找到匹配的模板:maui

我在我的機器上安裝了 .Net 5 和 Visual Studio 2019。

現在建議根據其目前文件使用 Visual Studio 創建 .NET Maui 應用程序。

老建議:

我建議使用提供的檢查工具。這將為您安裝模板,並確保其他所有內容都可以使用 Maui 進行開發。

安裝:dotnet tool install -g redth.net.maui.check

執行:maui-check –dev

這將檢查:

OpenJdk / AndroidSDK
.NET 6 Preview SDK
.NET MAUI / iOS / Android workloads and packs
.NET MAUI Templates
Workload Resolver .sentinel files for dotnet and Visual Studio Windows/Mac
Currently does not install workloads required for WinUI3

有一個已知問題,請手動安裝模板:

dotnet new -i Microsoft.Maui.Templates

引用自:https://stackoverflow.com/questions/65106633