Xamarin + sqlite-net 依赖错误

标签 xamarin xamarin.ios xamarin.android sqlite-net

所以我正在尝试使用适用于 iOS + Android 的 Xamarin 设置跨平台应用。

我在 PCL 中包含了 sqlite-net 包,现在我遇到了 Windows 8 或 Silverlight(我都不需要支持)的依赖性问题。

如果我选择像 profile24 这样支持 silverlight 的配置文件,我会收到以下错误:

Error CS0234: The type or namespace name 'Stopwatch' does not exist in the namespace `System.Diagnostics'. Are you missing an assembly reference? (CS0234)

另一方面,如果我在 windows 8 和 windows phone 8 上选择像 profile49 这样的配置文件,我会收到如下错误:

Error CS0117: 'System.Threading.Thread' does not contain a definition for `VolatileWrite' (CS0117)

或者使用 profile111(windows 8 + windows phone 8.1):

Error CS0103: The name `Thread' does not exist in the current context (CS0103)

问题是,我不需要支持这些平台。但是没有配置文件只包括 Xamarin.iOS + Xamarin.Android。我被迫支持那些带来麻烦的平台。

我能做什么?

最佳答案

好吧,如果有人遇到同样的问题:即使两者都在包库中可用,但要在 PCL 中使用,您必须包含 SQLite.NET PCL 包,而不是名为sqlite-net.

更新:另外,如果你想使用异步方法,你必须包含不同的包 SQLite.Net.Async-PCL。

关于Xamarin + sqlite-net 依赖错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37296692/

相关文章:

android - 单体机器人 : Iterate over the controls in an Activity?

c# - 从 iPhone 保存计算机可访问的文件

xamarin - 当前命名空间中不存在类型或命名空间 'App'

ios - iPhone/iPad : How to make UITextField readonly (but not disabled)?

Android 模拟器不在 xamarin 上运行

android - canvas.DrawRect 导致应用程序自动退出

android - Xamarin Android - 从 preferenceFragment 获取偏好

xamarin - 同时在多个设备上运行 Android 应用程序 (Xamarin)

c# - 传递参数以点击手势 Xamarin 表单

linker - xamarin.ios/monotouch、mvvmcross 和链接问题