2014-09-29 154 views
1

我有一個Windows Phone應用程序,我想添加NLog。來自Nlog的數據我想放入一個SQLite數據庫。NLOG,在Windows Phone 8上登錄到SQLite

如果我在WindowsForm應用程序中這樣做,這是沒有問題的,我只需添加NLog和System.Data.SQLite形式的Nuget。但在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."

延Borrisholt

回答

1

我最近剛寫了一篇如何在Windows Phone 8的(主要是8.1),使用SQLite,但它應該是一個文章相同。你可以找到這個文章在這裏:http://www.brainchest.net/?p=1401

總之,你所要做的是:

  1. 通過工具下載的Windows Phone 8.1的擴展SQLite的 - >擴展和更新 - >搜索爲「Windows Phone 8.1的SQLite」在線,並添加一個對你的項目的參考(我猜如果你的目標是Windows Phone 8.0以上,你需要「Windows Phone的SQLite」)。
  2. Via NuGet將以下軟件包下載到您的項目中:SQLite.Net PCL,SQLite.Async.Net PCL,sqlite-net-wp8,SQLite.Net PCL - WindowsPhone8平臺
  3. 將平臺目標設置爲x86或ARM ,這取決於你部署項目的位置。對於仿真器使用x86,對於設備使用ARM。 AnyCPU不起作用,因爲SQLite本身是原生的。