xamarin - 如何修复 Xamarin Forms 空白项目构建错误
问题描述
我在新的 Xamarin 空白项目中有一些错误。
我试过了:
- 重新打开 VS
- 更新所有 Nuget 包
- 重新安装 VS
项目首次构建失败,出现以下错误:
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
解决方案
请尝试以下
升级 Xamarin.Forms 解决方案中所有项目的所有 Xamarin.Forms 和 Xamarin.Essentials nuget 包
关闭 Visual Studio
进入您的 Android 项目的 .csproj 文件并将所有 Xamarin.Android 支持 nuget 包(可能类似于 v27.xxx)的版本号更改为最新版本,即 v28.0.0.1(只需全部替换即可更新到那个版本)
从每个项目文件夹中删除 bin 和 obj 文件夹
在 Visual Studio 中重新打开解决方案,进行清理并重新构建
推荐阅读
- c++ - 为什么在使用字符串标记器后我不能 cout
- python - 如何更改 DataFrame 列值以便相应地修改平均值?
- swift - 如何将获取的数据发送到我的 ViewController?
- shader - Scenekit 如何在地球/球体周围弯曲/扭曲/弯曲瓷砖
- git - 如何使用原始项目的更改更新本地克隆的 git 存储库(没有分叉!)
- javascript - onChage 多个输入
- excel - VBA Instr 函数未从工作簿中所有工作表中提到的位置找到子字符串,并且仅从一个可见工作表中删除
- r - R中是否有将变量或列标题转换为一个垂直列的函数?
- audio - 使用 FFmpeg 的文件 (mp3) 连接问题
- python - while循环可以用其他while循环打印小时吗?