升级Xamarin.Forms后如何解决CS0012错误?

时间:2018-07-19 18:09:13

标签: xamarin.forms compiler-errors updates .net-standard

我使用的Xamarin.Forms版本为2.5.1.527436,我的项目正在编译并完美运行,然后我将其更新为Xamarin.Forms 3.1.0.637273,而我的项目不再编译。

我收到几个错误:

Error   CS0012  The type 'Action' is defined in an assembly that is not
referenced. You must add a reference to assembly 'netstandard, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

enter image description here

如何解决此错误“ CS0012”?

1 个答案:

答案 0 :(得分:1)

也许您仍在引用netstandard1.x。在这种情况下,您必须切换到netstandard 2.0,因为自Xamarin.Forms 3.0以来这是必需的

您可以在https://developer.xamarin.com/releases/xamarin-forms/xamarin-forms-3.0/3.0.0/上查看详细信息 特别是,我建议阅读“构建任务依赖项更新”部分。