Visual Studio .NET MAUI项目问题

wfveoks0  于 2022-12-30  发布在  .NET
关注(0)|答案(2)|浏览(317)

I have added the MAUI workload in Visual Studio 2022 v17.3.0 Preview 1.1 and I have the following set of errors after creating my project.

Errors:
Severity Code Description Project File Line Suppression State Warning NU1505 Duplicate 'PackageDownload' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageDownload' items are: Microsoft.NETCore.App.Host.win-x64 [6.0.3], Microsoft.NETCore.App.Host.win-x64 [6.0.3], Microsoft.NETCore.App.Host.win-x64 [6.0.3], Microsoft.NETCore.App.Host.win-x64 [6.0.3]. MauiApp2 C:\Users\Trevoir\source\repos\MauiApp2\MauiApp2\MauiApp2.csproj 1
Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-android, net6.0-ios, net6.0-maccatalyst MauiApp2 C:\Users\Trevoir\source\repos\MauiApp2\MauiApp2\MauiApp2.csproj 1
Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-android, net6.0-ios, net6.0-maccatalyst MauiApp2 C:\Users\Trevoir\source\repos\MauiApp2\MauiApp2\MauiApp2.csproj 1
Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-android, net6.0-ios, net6.0-maccatalyst MauiApp2 C:\Users\Trevoir\source\repos\MauiApp2\MauiApp2\MauiApp2.csproj 1
Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-android, net6.0-ios, net6.0-maccatalyst MauiApp2 C:\Users\Trevoir\source\repos\MauiApp2\MauiApp2\MauiApp2.csproj 1
Error NETSDK1139 The target platform identifier android was not recognized. MauiApp2 C:\Program Files\dotnet\sdk\7.0.100-preview.3.22179.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 112 Error NETSDK1139 The target platform identifier ios was not recognized. MauiApp2 C:\Program Files\dotnet\sdk\7.0.100-preview.3.22179.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 112 Error NETSDK1139 The target platform identifier maccatalyst was not recognized. MauiApp2 C:\Program Files\dotnet\sdk\7.0.100-preview.3.22179.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 112
I have done the maui-check and it always ends with the following:

.NET SDK - Workloads (6.0.200) Checkup... x android-aot (Microsoft.NET.Sdk.Android.Manifest-6.0.200 : 31.0.200-preview.12.2) not installed. x ios (Microsoft.NET.Sdk.iOS.Manifest-6.0.200 : 15.2.200-preview.12.4) not installed. x maccatalyst (Microsoft.NET.Sdk.MacCatalyst.Manifest-6.0.200 : 15.2.200-preview.12.4) not installed. x tvos (Microsoft.NET.Sdk.tvOS.Manifest-6.0.200 : 15.2.200-preview.12.4) not installed. x macos (Microsoft.NET.Sdk.macOS.Manifest-6.0.200 : 12.1.200-preview.12.4) not installed. x maui (Microsoft.NET.Sdk.Maui.Manifest-6.0.200 : 6.0.200-preview.12.2441) not installed. ! Managing Workload installation from the CLI is NOT recommended. Instead you should install the latest Visual Studio preview to automatically get the newest release of .NET MAUI workloads installed.

r1zk6ea1

r1zk6ea11#

在电脑上:恕我直言,不要运行毛伊岛。也不要用任何“旧”的方式安装毛伊岛的工作负载。
(On Mac,VS 17.3.0预览版1.1仍然需要一个命令行步骤的Android。
我建议重新开始

  • 卸载VS预览。
  • 重新启动PC。
  • 运行VS安装程序,选择
    • 预览版本,以及
    • 工作负载“.NET多平台应用程序UI开发”。
  • 使用“Maui”模板创建一个新项目。
  • 构建。
wecizke3

wecizke32#

我可以通过在包含**.csproj**文件的文件夹中运行以下命令来使其工作。

dotnet workload restore

相关问题