定期我得到以下异常:
无法加载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。 它可以工作几天,但之后又会坏掉。
有人见过这样的情况吗,有解决方案吗?
当前回答
这对我来说很管用。
With Visual Studio open, search and install SQLite.Core via the NUGET Package manager. Go to Solution Explorer in VS, Right click your PROJECT NAME-->ADD-->NEW FOLDER Name the folder x64 Repeat the process and add folder and name it x86 Right click the x64 folder-->ADD-->EXISTING ITEM Then browse to the DEBUG FOLDER. You will find the x64 folder. Open it and select the "SQLite.Interop.dll" file then hit OK. Repeat step 5 for the x86 folder. Right click the DLL that you just added and select PROPERTIES. In the option Copy to Output Directory, choose Copy always. Repeat step 7 for both DLLs in x64 and x86 folder.
下次构建该项目并使用另一台计算机时,它应该可以正常工作。
其他回答
我在运行Visual Studio Express 2013时也遇到了同样的问题。我尝试了这里和其他地方提到的几种解决方案,但都没有用。我希望这个修正能帮助到其他人。
我通过在测试基于sqlite的服务的测试类上使用deploymenttem属性来修复它。
例子:
[TestClass]
[DeploymentItem(@"x86\SQLite.Interop.dll", "x86")] // this is the key
public class LocalStoreServiceTests
{
[TestMethod]
public void SomeTestThatWasFailing_DueToThisVeryIssue()
{
// ... test code here
}
}
这将导致所需的SQLite.Interop.dll被复制到适当的“TestResults”文件夹中的x86目录。
全是绿色的。一切都很好。
这对我来说很管用。
With Visual Studio open, search and install SQLite.Core via the NUGET Package manager. Go to Solution Explorer in VS, Right click your PROJECT NAME-->ADD-->NEW FOLDER Name the folder x64 Repeat the process and add folder and name it x86 Right click the x64 folder-->ADD-->EXISTING ITEM Then browse to the DEBUG FOLDER. You will find the x64 folder. Open it and select the "SQLite.Interop.dll" file then hit OK. Repeat step 5 for the x86 folder. Right click the DLL that you just added and select PROPERTIES. In the option Copy to Output Directory, choose Copy always. Repeat step 7 for both DLLs in x64 and x86 folder.
下次构建该项目并使用另一台计算机时,它应该可以正常工作。
你需要通过NuGet安装System.Data.SQLite.Core。 如果您使用InnoSetup,请确保在.iss文件的[Files]部分中有以下行:
Source: "C:\YourProjectPath\bin\Release\x64\*"; DestDir: "{app}\x64"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\YourProjectPath\bin\Release\x86\*"; DestDir: "{app}\x86"; Flags: ignoreversion recursesubdirs createallsubdirs
更改项目的路径“YourProjectPath”。
正如SQLite wiki所说,你的应用程序部署必须是:
所以你要遵守规则。找到与您的目标平台匹配的dll,并将其放在图片中描述的位置。dll可以在YourSolution/packages/System.Data.SQLite.Core.%version%/中找到。
我有应用程序部署的问题,所以我只是添加了正确的SQLite.Interop.dll到我的项目中,在安装项目中添加了x86文件夹到applicicationfolder,并添加了文件引用到dll。
对于任何关注这个问题的人来说:
如果您使用nuget包,它会安装一个构建规则,为您执行复制。(参见System.Data.SQLite.Core.1.0.94.0\build -或任何你安装的Core版本)。
nuget安装程序会自动将规则添加到项目文件中。
但是,这仍然不能解决测试用例问题。deploymenttem (https://stackoverflow.com/a/24411049/89584)方法似乎是惟一可行的方法。