环境:Windows10 Enterprise 64位,.NET Framework 4.0,Visual Studio 2017

1,首先确认SQLite动态库的版本。

    态库下载地址:http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

(1)确认Project引用的System.Data.SQLite.dll或System.Data.SQLite.Core.dll动态库的版本号是否匹配

(2)确认系统是否安装C++ 2010 SP1 runtime(x86/64)

(3)右键点击(x86/x64)文件夹下面的SQLite.Interop.dll,查看属性。确保Copy to Output Directory设置为“Copy if newer”或“Copy always”

WinForm无法加载'SQLite.Interop.dll'的问题

 

 WinForm无法加载'SQLite.Interop.dll'的问题

 

 WinForm无法加载'SQLite.Interop.dll'的问题

 

 2,解决问题

如果第一部分中的三个步骤都没有问题。请在启动程序中添加引用依赖项System.Data.SQLite.dll或System.Data.SQLite.Core.dll。(不论启动程序是否直接依赖于System.Data.SQLite.dll或System.Data.SQLite.Core.dll。

可手动或使用NUGet添加应用的动态库。前提是确保版本号和SQLite.Interop.dll相匹配。

然后重新编译启动项目就可以了。

WinForm无法加载'SQLite.Interop.dll'的问题

 

 

备注:网上有人说把项目设置为X64位而不是Any CPU即可。本人测试过,这种办法对我来说并没解决问题。

相关文章:

  • 2021-04-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-16
  • 2021-12-28
  • 2021-11-17
  • 2022-03-04
  • 2021-07-10
相关资源
相似解决方案