如何修复Xamarin Forms空白项目生成错误

时间:2019-07-01 06:33:53

标签: xamarin xamarin.forms

我在新的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…nuget\packages\xamarin.android.support.annotations\28.0.0.1\build\monoandroid90\Xamarin.Android.Support.BuildTasks.dll. Could not load file or assembly ‘…nuget\packages\xamarin.android.support.annotations\28.0.0.1\build\monoandroid90\Xamarin.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

2 个答案:

答案 0 :(得分:0)

请尝试以下

  1. 升级Xamarin.Forms解决方案中所有项目中的所有Xamarin.Forms和Xamarin.Essentials nuget程序包

  2. 关闭Visual Studio

  3. 进入您的Android项目的.csproj文件,并将所有Xamarin.Android支持的nuget软件包(可能类似于v27.xxx)的版本号更改为最新版本,即v28.0.0.1(只是这样做)全部替换以更新到该版本)

  4. 从每个项目文件夹中删除bin和obj文件夹

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

答案 1 :(得分:0)

查看有关 Xamarin入门的教程。检查有关Requirements的信息和Installation的步骤。

此外,您是否尝试过在计算机上部署download_demo?怎么样?