如何修复Xamarin形成空白项目构建错误



我在新Xamarin空白项目中有一些错误。

我尝试了:

  • 重新开放vs
  • 更新所有Nuget软件包
  • 重新安装vs

Projet首先构建失败了以下错误:


Severity    Code    Description Project File    Line    Suppression State
Error   Can not resolve reference: Xamarin.Android.Support.CustomTabs, referenced by Xamarin.Essentials. Please add a NuGet package or assembly reference for Xamarin.Android.Support.CustomTabs, or remove the reference to Xamarin.Essentials. TestAPP.Android
Severity    Code    Description Project File    Line    Suppression State
Error   Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.DrawerLayout. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.DrawerLayout.    TestAPP.Android
Severity    Code    Description Project File    Line    Suppression State
Error   The “Xamarin.Android.Support.BuildTasks.VerifyVersionsTask” task could not be loaded from the assembly…nugetpackagesxamarin.android.support.annotations28.0.0.1buildmonoandroid90Xamarin.Android.Support.BuildTasks.dll. Could not load file or assembly ‘…nugetpackagesxamarin.android.support.annotations28.0.0.1buildmonoandroid90Xamarin.Android.Support.BuildTasks.dll’ or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.   TestAPP.Android
Severity    Code    Description Project File    Line    Suppression State
Error   Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.CoordinaterLayout. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.CoordinaterLayout.  TestAPP.Android
Severity    Code    Description Project File    Line    Suppression State
Error   Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.SlidingPaneLayout. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.SlidingPaneLayout.  TestAPP.Android
Severity    Code    Description Project File    Line    Suppression State
Error   Can not resolve reference: Xamarin.Android.Arch.Lifecycle.Common, referenced by Xamarin.Android.Arch.Lifecycle.LiveData.Core. Please add a NuGet package or assembly reference for Xamarin.Android.Arch.Lifecycle.Common, or remove the reference to Xamarin.Android.Arch.Lifecycle.LiveData.Core.  TestAPP.Android
Severity    Code    Description Project File    Line    Suppression State
Error   Can not resolve reference: Xamarin.Android.Arch.Core.Common, referenced by Xamarin.Android.Arch.Lifecycle.LiveData. Please add a NuGet package or assembly reference for Xamarin.Android.Arch.Core.Common, or remove the reference to Xamarin.Android.Arch.Lifecycle.LiveData.  TestAPP.Android
Severity    Code    Description Project File    Line    Suppression State
Error   Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.SwipeRefreshLayout. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.SwipeRefreshLayout.    TestAPP.Android
Severity    Code    Description Project File    Line    Suppression State
Error   Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.CustomView. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.CustomView.    TestAPP.Android
Severity    Code    Description Project File    Line    Suppression State
Error   Can not resolve reference: Xamarin.Android.Support.v7.RecyclerView, referenced by Xamarin.Forms.Platform.Android. Please add a NuGet package or assembly reference for Xamarin.Android.Support.v7.RecyclerView, or remove the reference to Xamarin.Forms.Platform.Android.  TestAPP.Android

请尝试以下

  1. 升级所有Xamarin.forms和Xamarin.Sentials Nuget软件包跨您的Xamarin.forms解决方案

  2. 关闭Visual Studio

  3. 进入您的Android Project的.CSPROJ文件,然后更改所有Xamarin.android支持Nuget软件包(可能是v27.x.x.x.x(的版本编号,以最新内容(即V28.0.0.1(a替换全部更新到该版本(

  4. 从每个项目文件夹中删除您的垃圾箱和OBJ文件夹

  5. 在Visual Studio中重新打开解决方案,进行清洁和重建

最新更新