定期我得到以下异常:

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

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

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

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

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


当前回答

升级到Visual Studio 2019版。16.10导致了我的问题,其中msbuild报告了以下System.Data.SQLite.Core-package:

CopySQLiteInteropFiles:
Skipping target "CopySQLiteInteropFiles" because it has no outputs.

https://github.com/dotnet/msbuild/issues/6493

微软表示,该漏洞已被修复。16.10.4. 现在只需要等待AppVeyor更新他们的Visual Studio图像(在此之前,可以使用以前的Visual Studio 2019)。

现在,AppVeyor正在为当前和以前的Visual Studio 2019-image使用破碎的dotnet-build-engine。现在一个必须显式安装dotnet sdk ver。5.0.302:

Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile "$env:temp/dotnet-install.ps1"; & $env:temp\dotnet-install.ps1 -Architecture x64 -Version 5.0.302 -InstallDir "$env:ProgramFiles\dotnet"

其他回答

大会上会有竞争吗?检查DLL上是否有其他具有文件锁的应用程序。

如果是这个原因,使用Sysinternal的Process Explorer之类的工具来发现有问题的程序应该很容易。

HTH, 粘土

简而言之

为了让它也能与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

复制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

如果您试图在64位项目中运行32位dll,也可能会出现此错误。

当我在x86和x64文件夹中放置相同的文件(32位版本的SQLite.Interop.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.