【发布时间】:2015-08-04 14:55:49
【问题描述】:
我们从 sqlite-net 更改为 sqlite.net PCL 版本。我们的项目在旧版本上运行良好 - 在 PCL 版本中,我们现在必须通过 using 明确声明我们的平台。
var conn = new SQLiteConnection(new SQLitePlatformWin32(), Path.Combine(folderPath, dbName));
但是现在,当我调用这条线时,我们得到一个
在 SQLite.Net.Platform.Win32.dll 中发生了“System.TypeInitializationException”类型的第一次机会异常
附加信息:“SQLite.Net.Platform.Win32.SQLiteApiWin32Internal”的类型初始化程序引发异常。
内部异常告诉我们
{"加载原生 sqlite 库失败"}
堆栈跟踪:
在 SQLite.Net.Platform.Win32.SQLiteApiWin32Internal.sqlite3_open_v2(Byte[] filename, IntPtr& db, Int32 flags, IntPtr zvfs)
在 SQLite.Net.Platform.Win32.SQLiteApiWin32.Open(Byte[] filename, IDbHandle& db, Int32 flags, IntPtr zvfs)
在 SQLite.Net.SQLiteConnection..ctor(ISQLitePlatform sqlitePlatform, String databasePath, SQLiteOpenFlags openFlags, Boolean storeDateTimeAsTicks, IBlobSerializer 序列化器, IDictionary
2 tableMappings, IDictionary2 extraTypeMappings, IContractResolver 解析器)在 SQLite.Net.SQLiteConnection..ctor(ISQLitePlatform sqlitePlatform, String databasePath, Boolean storeDateTimeAsTicks, IBlobSerializer 序列化器, IDictionary
2 tableMappings, IDictionary2 extraTypeMappings, IContractResolver 解析器)
但是 sqlite3.dll 位于应用程序文件夹中,并且它确实适用于未分叉的版本。我尝试为 x86 和 x64 进行编译,并为 Win32 下载了最新的 sqlite3.dll,但都没有成功。我们缺少什么?
【问题讨论】:
标签: c# sqlite sqlite-net