关于c#:NLOG,在Windows Phone 8上登录到SQLite

NLOG, Log to SQLite on windows Phone 8

我有一个要添加NLog的Windows Phone应用程序。我想将Nlog中的数据放入SQLite数据库中。

如果我正在WindowsForm应用程序中执行此操作,那没问题,我只需在Nuget中添加NLog和System.Data.SQLite。但是在Windows Phone 8上该怎么办?

我已经准备好Nlog。 (下载并手动添加参考),但是如何将System.Data.SQLite添加到项目中?当我尝试从Nuget安装它时,出现以下错误:

"Could not install package 'System.Data.SQLite.Core.MSIL 1.0.94.0'.
You are trying to install this package into a project that targets
'WindowsPhone,Version=v8.0', but the package does not contain any
assembly references or content files that are compatible with that
framework. For more information, contact the package author."

Jens Borrisholt


我最近刚刚写了一篇有关如何在Windows Phone 8(主要是8.1)中使用SQLite的文章,但应该相同。您可以在这里找到本文:http://www.brainchest.net/?p=1401

简而言之,您需要执行以下操作:

  • 通过转到工具->扩展和更新->在线搜索" SQLite for Windows Phone 8.1"下载SQLite for Windows Phone 8.1扩展,并添加对项目的引用(我想您需要" SQLite for Windows Phone"代替) (如果您定位的是Windows Phone 8.0及更高版本)。
  • 通过NuGet将以下软件包下载到您的项目中:SQLite.Net PCL,SQLite.Async.Net PCL,sqlite-net-wp8,SQLite.Net PCL-WindowsPhone8平台
  • 根据部署项目的位置,将平台目标设置为x86或ARM。对于仿真器,请使用x86;对于设备,请使用ARM。 AnySQL不起作用,因为SQLite本身是本机的。