我们从sqlite.net转变为sqlite.net PCL版本.我们的项目与旧的一个很好的工作-与PCL版本,我们现在必须明确声明我们的平台使用。
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[]文件名,IntPtr& db,Int32标志,IntPtr zvfs) 在SQLite.Net.Platform.Win32.SQLiteApiWin32.Open(Byte[]文件名,IDbHandle& db,Int32标志,IntPtr zvfs) 在SQLite.Net.SQLiteConnection..ctor(ISQLitePlatform sqlitePlatform,字符串databasePath,SQLiteOpenFlags openFlags,布尔storeDateTimeAsTicks,IBlobSerializer序列化程序,IDictionary
2 tableMappings, IDictionary2 extraTypeMappings,IContractResolver解析器) 在SQLite.Net.SQLiteConnection..ctor(ISQLitePlatform sqlitePlatform,字符串databasePath,布尔storeDateTimeAsTicks,IBlobSerializer序列化程序,IDictionary2 tableMappings, IDictionary2 extraTypeMappings,IContractResolver解析器)
然而,sqlite3.dll位于应用程序文件夹中,它实际上处理了未分叉版本。我一直在为x86和x64进行编译,下载了最新的用于Win32的sqlite3.dll,但都没有成功。我们少了什么?
发布于 2015-05-26 19:08:13
我在一个测试项目中也遇到了同样的问题。通过为http://www.nuget.org/packages/System.Data.SQLite.Core添加包SQLitePlatformWin32来解决这个问题。
虽然在实际版本中没有被列为依赖项,但它在之前的平台nuget包(http://www.nuget.org/packages/SQLite.Net.Platform.Win32/)中出现过。
此外:在使用SQLitePlatformGeneric的情况下,应该将sqlite3.dll的副本放在输出目录中。
https://stackoverflow.com/questions/30399165
复制相似问题