无法加载文件或程序集System.Data.SQLite.SEE.License

r7s23pms  于 12个月前  发布在  SQLite
关注(0)|答案(1)|浏览(425)

我使用的是System.Data.SQLite.Core版本1.0.115.5。我正在尝试创建并打开一个SQLiteConnection,如下所示。

string DatabaseName = GetDatabasePath();
var sqlite2 = new SQLiteConnection($"Data Source={DatabaseName}");
sqlite2.Open();

GetDatabasePath是一个返回DB文件完整路径的函数。
我得到了以下例外。

System.IO.FileNotFoundException
  HResult=0x80070002
  Message=Could not load file or assembly 'System.Data.SQLite.SEE.License, Version=1.0.115.5, Culture=neutral, PublicKeyToken=433d9874d0bb98c5, processorArchitecture=MSIL'. The system cannot find the file specified.

根据我的研究,System.Data.SQLite.SEE.License是SQLite加密扩展的一部分。如果要为数据库创建密码,则使用此选项。然而,我没有使用数据库的密码。为什么我得到这个错误?

pxq42qpu

pxq42qpu1#

我和你一样犯了同样的错误。我也没有对数据库进行任何加密。所以我认为这实际上应该是System.Data.SQLite.Core本身的一个bug。
您需要将System.Data.SQLite.Core版本从1.0.115.5更新到1.0.116
需要注意的是,您最终引用的版本可能由第三方库的版本决定。例如,我遇到了这个问题。这就是我的理由https://github.com/saleem-mirza/serilog-sinks-sqlite/issues/46

相关问题