【发布时间】:2026-01-19 00:25:11
【问题描述】:
我正在尝试在 Xamarin Studio 中的 Xamarin.iOS 项目中接受新的 PCL 乐趣。我为我的项目创建了一个 PCL“核心”库,并通过 NuGet 添加了Splat (v0.3.4)。然后,在一个使用中的 iOS 项目中,我引用了我的核心库。一旦我这样做了,就会出现几个编译错误。
其中之一:
Error CS0012: The type `System.Drawing.PointF' is defined in an assembly that is not referenced. Consider adding a reference to assembly `Splat.Portable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' (CS0012)
多个:
Error CS0029: Cannot implicitly convert type `System.Drawing.PointF [monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]' to `System.Drawing.PointF [Splat.Portable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]' (CS0029)
看起来这个问题已经在自 v0.3.4 命中 NuGet 后登陆的 pull request to Splat 中得到解决。按照那里的注释,我在 iOS 项目中添加了对 Splat.Portable.dll 的引用。当我这样做时,编译错误会变成抱怨类型定义太多。
Error CS0433: The imported type `System.Drawing.RectangleF' is defined multiple times (CS0433)
Error CS0433: The imported type `System.Drawing.PointF' is defined multiple times (CS0433)
是否可以使用 Xamarin Studio 4.2.1 (Xamarin.iOS 7.0.4.209) 和 Splat 0.3.4 来解决这些错误,还是我需要构建具有出色类型转发功能的最新代码?
【问题讨论】:
标签: ios xamarin.ios portable-class-library xamarin-studio