基础安装可参考 官方地址
但是安装MAUI的时候出现了错误,错误如下:
解决方法:
文件名称: Versions.props
<Project> <!--Package versions--> <PropertyGroup> <MicrosoftDotnetSdkInternalPackageVersion>6.0.100-preview.5.21302.13</MicrosoftDotnetSdkInternalPackageVersion> <MicrosoftAndroidSdkWindowsPackageVersion>30.0.100-preview.5.28</MicrosoftAndroidSdkWindowsPackageVersion> <MicrosoftMacCatalystSdkPackageVersion>14.5.100-preview.5.894</MicrosoftMacCatalystSdkPackageVersion> <MicrosoftiOSSdkPackageVersion>14.5.100-preview.5.894</MicrosoftiOSSdkPackageVersion> <MicrosofttvOSSdkPackageVersion>14.5.100-preview.5.894</MicrosofttvOSSdkPackageVersion> <MicrosoftmacOSSdkPackageVersion>11.3.100-preview.5.894</MicrosoftmacOSSdkPackageVersion> </PropertyGroup> <PropertyGroup> <!-- Trim all characters after first `-` or `+` is encountered. --> <DotNetPreviewVersionBand Condition=" '$(DotNetPreviewVersionBand)' == '' ">$([System.Text.RegularExpressions.Regex]::Replace($(MicrosoftDotnetSdkInternalPackageVersion), `[-+].*$`, ""))</DotNetPreviewVersionBand> </PropertyGroup> </Project>
文件名称:maui.manifest.json
{ "check": { "toolVersion": "0.5.6", "variables": { "MAUI_VERSION": "6.0.100-preview.5.794", "OPENJDK_VERSION": "11.0.10.9" }, "variableMappers":[ { "$type" : "DotNetCheck.Manifest.XmlVariableMapper, MauiCheck", "sourceUri" : "C:\Users\Administrator\Desktop\Versions.props", "mappings": [ { "name": "DOTNET_SDK_VERSION", "xpath": "//Project/PropertyGroup/MicrosoftDotnetSdkInternalPackageVersion/text()" }, { "name": "MACCATALYST_SDK_VERSION", "xpath": "//Project/PropertyGroup/MicrosoftMacCatalystSdkPackageVersion/text()" }, { "name": "IOS_SDK_VERSION", "xpath": "//Project/PropertyGroup/MicrosoftiOSSdkPackageVersion/text()" }, { "name": "TVOS_SDK_VERSION", "xpath": "//Project/PropertyGroup/MicrosofttvOSSdkPackageVersion/text()" }, { "name": "MACOS_SDK_VERSION", "xpath": "//Project/PropertyGroup/MicrosoftmacOSSdkPackageVersion/text()" }, { "name": "ANDROID_SDK_VERSION", "xpath": "//Project/PropertyGroup/MicrosoftAndroidSdkWindowsPackageVersion/text()" } ] } ], "openjdk": { "version": "11.0", "urls": { "win64": "https://aka.ms/download-jdk/microsoft-jdk-$(OPENJDK_VERSION)-windows-x64.msi", "osx": "https://aka.ms/download-jdk/microsoft-jdk-$(OPENJDK_VERSION)-macos-x64.pkg" } }, "xcode": { "minimumVersion": "12.5" }, "vswin": { "minimumVersion": "16.10.0" }, "vsmac": { "minimumVersion": "8.10.0", "optional": "true" }, "android": { "packages": [ { "path": "emulator", "version": "30.4.5" }, { "path": "build-tools;30.0.2", "version": "30.0.2" }, { "path": "platforms;android-30", "version": "3" }, { "path": "system-images;android-30;google_apis;x86", "version": "9", "alternatives": [ { "path": "system-images;android-30;google_apis_playstore;x86", "version": "9" }, { "path": "system-images;android-30;google_apis;x86_64", "version": "10" }, { "path": "system-images;android-30;google_apis_playstore;x86_64", "version": "10" } ] }, { "path": "platform-tools", "version": "31.0.0" } ], "emulators": [ { "sdkId": "system-images;android-30;google_apis;x86", "alternateSdkIds": [ "system-images;android-30;google_apis_playstore;x86", "system-images;android-30;google_apis;x86_64", "system-images;android-30;google_apis_playstore;x86_64" ], "desc": "Android Emulator - x86 - API30 - Google API's", "apiLevel": 30, "tag": "google_apis", "device": "pixel" } ] }, "dotnet": { "sdks": [ { "version": "$(DOTNET_SDK_VERSION)", "requireExact": true, "enableWorkloadResolver": false, "urls": { "win64": "https://dotnetcli.azureedge.net/dotnet/Sdk/$(DOTNET_SDK_VERSION)/dotnet-sdk-$(DOTNET_SDK_VERSION)-win-x64.exe", "win": "https://dotnetcli.azureedge.net/dotnet/Sdk/$(DOTNET_SDK_VERSION)/dotnet-sdk-$(DOTNET_SDK_VERSION)-win-x86.exe", "osx": "https://dotnetcli.azureedge.net/dotnet/Sdk/$(DOTNET_SDK_VERSION)/dotnet-sdk-$(DOTNET_SDK_VERSION)-osx-x64.pkg" }, "packageSources": [ "https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" ], "workloads": [ { "workloadId": "microsoft-android-sdk-full", "packageId": "Microsoft.NET.Sdk.Android.Manifest-6.0.100", "version": "$(ANDROID_SDK_VERSION)" }, { "workloadId": "microsoft-ios-sdk-full", "packageId": "Microsoft.NET.Sdk.iOS.Manifest-6.0.100", "version": "$(IOS_SDK_VERSION)" }, { "workloadId": "microsoft-maccatalyst-sdk-full", "packageId": "Microsoft.NET.Sdk.MacCatalyst.Manifest-6.0.100", "version": "$(MACCATALYST_SDK_VERSION)" }, { "workloadId": "microsoft-tvos-sdk-full", "packageId": "Microsoft.NET.Sdk.tvOS.Manifest-6.0.100", "version": "$(TVOS_SDK_VERSION)" }, { "workloadId": "microsoft-macos-sdk-full", "packageId": "Microsoft.NET.Sdk.macOS.Manifest-6.0.100", "version": "$(MACOS_SDK_VERSION)" } ], "packs": [ { "id": "Microsoft.Maui.Templates", "version": "$(MAUI_VERSION)", "skipManifestCheck": true, "packKind": "template", "templateShortName": "maui" } ] } ] } } }
找到 maui.manifest.json 中的 sourceUri 节点。将地址改为 Versions.props 的文件地址
然后执行下面命令,不要 [ ]
maui-check -m [maui.manifest.json的地址]