所以我正在尝试使用适用于 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/