定期我得到以下异常:
无法加载DLL 'SQLite.Interop.dll':无法找到指定的模块。(异常来自HRESULT: 0x8007007E)
我使用的是1.0.82.0。在VS2010, Win7 64操作系统下使用nuget安装。
一旦异常开始出现,它就会不断出现——在调试和发布中,在VS内部或外部运行应用程序。
阻止它的唯一方法就是退出并重新登录。不抛出异常并加载dll。 它可以工作几天,但之后又会坏掉。
有人见过这样的情况吗,有解决方案吗?
定期我得到以下异常:
无法加载DLL 'SQLite.Interop.dll':无法找到指定的模块。(异常来自HRESULT: 0x8007007E)
我使用的是1.0.82.0。在VS2010, Win7 64操作系统下使用nuget安装。
一旦异常开始出现,它就会不断出现——在调试和发布中,在VS内部或外部运行应用程序。
阻止它的唯一方法就是退出并重新登录。不抛出异常并加载dll。 它可以工作几天,但之后又会坏掉。
有人见过这样的情况吗,有解决方案吗?
当前回答
如果您试图在64位项目中运行32位dll,也可能会出现此错误。
当我在x86和x64文件夹中放置相同的文件(32位版本的SQLite.Interop.dll)时,我得到了这个。
其他回答
扩展Kugel的回答,这对我来说是有效的(VS2015 Enterprise),利用dll中的SQLite,可以在构建和测试后从主项目中删除Nuget包:
1.安装Nuget包到主项目。
Install-Package System.Data.SQLite
2.构建应用程序并测试Sqlite连接是否正常工作:
select * from sqlite_master
3.从主版本卸载Nuget包。
UnInstall-Package System.Data.SQLite
4.手动删除SQLite和EntityFramework的dll引用:
System.Data.SQLite
System.Data.SQLite.EF6
System.Data.SQLite.Linq
从主项目的“包”中删除Xml引用。配置”XML文件。
这对我来说很有效,使我的项目保持干净。
Mine didn't work for unit tests either, and for some reason Michael Bromley's answer involving DeploymentItem attribute didn't work. However, I got it working using test settings. In VS2013, add a new item to your solution and search for "settings" and select the "Test Settings" template file. Name it "SqliteUnitTests" or something and open it. Select "Deployment" off to the right, and add Directory/File. Add paths/directories to your SQLite.Interop.dll file. For me, I added two paths, one each for Project\bin\Debug\x64 and Console\bin\Debug\x86. You may also want to add your Sqlite file, depending on how you expect your unit test/solution to access the file.
如果您试图在64位项目中运行32位dll,也可能会出现此错误。
当我在x86和x64文件夹中放置相同的文件(32位版本的SQLite.Interop.dll)时,我得到了这个。
复制SQLite.Interop.dll到项目目录。
src\
project\
bin\ <-- Past in bin
x64\
SQLite.Interop.dll <-- Copy this if 64
x86\
SQLite.Interop.dll <-- Copy this if 32
我知道我来晚了,但在我今天下载了最新的x86/x64(版本1.0.88.0)后,我就遇到了这个问题。我在VS2012中的本地IIS默认运行32位,没有简单的方法切换到x64。我的生产服务器运行64位。
无论如何,我安装了NuGet包到一个DLL项目,我得到了这个错误。为了让它工作,我必须把它安装到主站点项目中。即使它根本不涉及SQLite类。
我的猜测是SQLite使用入口程序集来检测要加载哪个版本的Interop。