【问题标题】:How to solve the error CS0012 after upgrading Xamarin.Forms? [duplicate]升级 Xamarin.Forms 后如何解决错误 CS0012? [复制]
【发布时间】:2018-12-27 23:37:43
【问题描述】:

我使用的是 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'.

如何解决这个错误“CS0012”?

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

    • 感谢您的帮助,使用 Visual Studio 安装程序安装 .NET 4.7.1 并更新 Windows 系统以构建 1803。
    • @LedMachine:为什么需要更新 Windows?如果答案对您有帮助,您可以将其标记为已接受的答案。
    猜你喜欢
    • 2021-02-22
    • 1970-01-01
    • 2019-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-17
    • 2013-07-13
    相关资源
    最近更新 更多