Xamarin + sqlite-net 依赖错误

Xamarin + sqlite-net dependency errors

所以我正在尝试使用 Xamarin 为 iOS + Android.

设置一个跨平台应用程序

我在 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)

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

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.