我有一個Xamarin Forms解決方案。我添加了sqlite-net-pcl作爲所有項目的參考。它在Android上運行良好,但在Windows 8.1和Windows Phone 8.1上崩潰。我有一個IOS項目,但目前我沒有OSX來試用它。無法加載DLL'e_sqlite3':無法找到指定的模塊
我用這個在Windows項目中訪問數據庫:
using System.IO;
using SQLite;
using Xamarin.Forms;
using HelloXamarin.Windows;
using Windows.Storage;
[assembly: Dependency(typeof(SQLiteDb))]
namespace HelloXamarin.Windows
{
public class SQLiteDb : ISQLiteDb
{
public SQLiteAsyncConnection GetConnection(string databaseName)
{
var documentsPath = ApplicationData.Current.LocalFolder.Path;
var path = Path.Combine(documentsPath, databaseName);
return new SQLiteAsyncConnection(path);
}
}
}
這裏是我的引用:
試圖訪問時,我得到這個異常數據庫:
「SQLite.SQLiteConnection」的類型初始值設定項引發異常。
無法加載DLL'e_sqlite3':無法找到指定的模塊。 (從HRESULT異常:0x8007007E)
- 在SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods.sqlite3_win32_set_directory(UInt32的directoryType,字符串目錄路徑)
- 在SQLitePCL.SQLite3Provider_e_sqlite3..ctor()
- 在SQLitePCL.Batteries_V2.Init( )在SQLite.SQLiteConnection..cctor()
我不知道如何解決這個問題,請幫助我!
整體解決方案可在GitHub上: https://github.com/apspot/HelloXamarin
我說SQLite,讓Windows運行時,但問題依然存在:[鏈接](https://ibb.co/iUwYo5) –
您是否也引用了Visual Studio Runtime C++ 2013庫? –
如果您的意思是「Microsoft Visual C++ 2013運行時軟件包...」比添加它作爲參考,您可以在[此屏幕截圖](https://ibb.co/iUwYo5) –