定期我得到以下异常:

无法加载DLL 'SQLite.Interop.dll':无法找到指定的模块。(异常来自HRESULT: 0x8007007E)

我使用的是1.0.82.0。在VS2010, Win7 64操作系统下使用nuget安装。

一旦异常开始出现,它就会不断出现——在调试和发布中,在VS内部或外部运行应用程序。

阻止它的唯一方法就是退出并重新登录。不抛出异常并加载dll。 它可以工作几天,但之后又会坏掉。

有人见过这样的情况吗,有解决方案吗?


当前回答

I got the same problem. However, finally, I can fix it. Currently, I use Visual Studio 2013 Community Edition. I just use Add->Existing Item... and browse to where the SQLite.Data.SQLite files are in (my case is 'C:\Program Files (x86)\System.Data.SQLite\2013\bin'). Please don't forget to change type of what you will include to Assembly Files (*.dll; *.pdb). Choose 'SQLite.Interop.dll' in that folder. From there and then, I can continue without any problems at all. Good luck to you all. ^_^ P.S. I create web form application. I haven't tried in window form application or others yet.

其他回答

简而言之

为了让它也能与NCrunch一起工作,我必须在NCrunch配置中添加与NuGet包一起提供的Interop.dll版本作为附加文件。

我的情况

我有一个c#解决方案,其中一个项目直接依赖于SQLite(一个帮助库)和一个使用这个帮助库的单元测试项目。我已经安装了System.Data.SQLite.Core版本1.0.97.0作为NuGet包。

在我的案例中,Marin提供的解决方案使它可以在Visual Studio和CI中工作。然而,这仍然会在NCrunch中提供错误。

在NCrunch配置中,我在单元测试项目设置下的“附加文件”中添加了以下路径:

..\packages\System.Data.SQLite.Core.1.0.97.0\build\net45\**.dll

在构建之前,尝试将平台目标设置为x86或x64(而不是任何CPU): 项目->属性->在Visual Studio中构建->平台目标。

因为这个问题的复杂性,我想在这里发表。我的解决方案是回滚到。net 4.0。我已经测试了3天了,还不能让System.Data.SQLite.Core.1.0.98.0与. net 4.5或. net 4.5.1一起工作。

测试在3台计算机、2台服务器和一台开发PC上进行。我还没能找到问题的根源。我已经尝试编辑.vsproj文件。我已经将SQLite.interop.dll添加到所有文件夹中。我已经将包应用到所有GAC文件夹,并单独删除和重新应用。最终删除。

我有System.Data.SQLite.Core.1.0.98.0与。net 4.0一起工作。我打算继续尝试迁移,但我想我会先开始一个新项目,看看我是否能让它以那种方式工作。它最初是一个。net 3.5 web应用程序,在我的旅行中,我发现大量的信息仍然引用了这个框架。

我在一个WebAPI/MVC5 web项目和一个特性测试项目的解决方案中遇到了这个问题,这两个项目都来自同一个数据访问(或“核心”)项目。像这里的许多人一样,我使用的是通过NuGet在Visual Studio 2013中下载的副本。

What I did, was in Visual Studio added a x86 and x64 solution folder to the Feature Test and Web Projects. I then did a Right Click | Add Existing Item..., and added the appropriate SQLite.interop.dll library from ..\SolutionFolder\packages\System.Data.SQLite.Core.1.0.94.0\build\net451\[appropriate architecture] for each of those folders. I then did a Right Click | Properties, and set Copy to Output Directory to Always Copy. The next time I needed to run my feature tests, the tests ran successfully.

我想到了一个解决办法。

在我的例子中,我使用的是Microsoft Visual Studio安装程序项目。 安装项目看不到来自主要输出的x64和x86文件夹和内容。

解决方案:

将x64和x86文件夹都添加到安装程序中的应用程序文件夹中。 添加两个文件夹的内容。

这将允许安装程序复制SQLite工作所需的DLL文件。