我有一个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) –