【问题标题】:Creating first .Net MAUI project创建第一个 .Net MAUI 项目
【发布时间】:2021-03-14 07:50:36
【问题描述】:

我尝试使用 Visual Studio 开发人员命令提示符在 Windows 中创建 Maui 项目,使用
命令:
dotnet new maui

但它没有创建毛伊岛项目,收到错误消息找不到匹配的模板:毛伊岛
我在我的机器上安装了 .Net 5 和 Visual Studio 2019。

【问题讨论】:

标签: .net windows xamarin xamarin.forms maui


【解决方案1】:

known issue,请手动安装模板:

dotnet new -i Microsoft.Maui.Templates

【讨论】:

    【解决方案2】:

    现在建议根据 current documentation 使用 Visual Studio 创建 .NET Maui 应用。

    老建议:

    我建议使用提供的check tool。这将为您安装模板,并确保其他所有内容都可以使用 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
    

    【讨论】:

    • 在链接的github页面中没有检查工具(我认为它是一些二进制文件?)。
    • @LeiYang - 看起来它移动了,我修复了链接,但让我用官方文档更新答案。
    【解决方案3】:

    这应该可以帮助你:

    https://github.com/dotnet/maui

    https://github.com/dotnet/net6-mobile-samples

    查看“使用 IDE”部分:

    使用 IDE

    IDE 集成到 Visual Studio、Visual Studio for Mac 和 Visual Studio Code 正在进行中。

    Visual Studio

    目前,您可以在 Windows 上使用 Visual Studio 2019 16.9(带有 Xamarin 工作负载),只需几个手动步骤即可运行 iOS 和 Android 应用程序 基于 .NET 6 构建。

    【讨论】:

      【解决方案4】:

      对于 Visual Studio 集成,您至少需要 16.11 预览版 1. 使用 maui-check 工具在您的系统上安装/升级先决条件。该工具会不断更新,以确保安装最新的 MAUI 功能。每次发布新预览版时(大约每月一次),重新运行 maui-check。

      【讨论】:

        【解决方案5】:

        下载 Visual Studio 2022 预览最新版本和 MAUI 所有默认模板现已可用。在这里尝试步骤 - https://www.msdevbuild.com/2021/11/First-Xamarin-MAUI-Mobile-App-Ios-android-windwos-visual-studio-2022.html

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2020-03-31
          • 1970-01-01
          • 1970-01-01
          • 2015-03-28
          • 2022-12-11
          • 2019-10-30
          • 1970-01-01
          相关资源
          最近更新 更多