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

3

我正在使用版本为1.0.115.5的System.Data.SQLite.Core。我尝试按照以下方式创建并打开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加密扩展的一部分。如果您想为数据库创建密码,则会使用它。然而,我没有为数据库设置密码。为什么我会收到这个错误?


1
建议使用 Microsoft.Data.Sqlite 替代。 - undefined
1
GetDatabasePath 函数返回的是什么? - undefined
@AnonCoward GetDatabasePath 是一个函数,它返回数据库文件的完整路径。 - undefined
1
@ramaral,我现在使用Microsoft.Data.Sqlite。 - undefined
2
Microsoft.Data.Sqlite 有一些缺点 - undefined
显示剩余2条评论
1个回答

0
我遇到了和你一样的错误。 我在数据库上也没有进行任何加密。 所以我认为这实际上应该是 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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接