I occasionally get the following exception:
DLL ‘SQLite.Interop.dll’ could not be loaded: The requested module was not found. (HRESULT Exception: 0x8007007E)
I’m using the 18.104.22.168 version, which I installed using nuget in Visual Studio 2010 on Windows 7 64.
Once an error arises, it continues to display in debug and release mode, as well as when the application is running within or outside of Visual Studio.
Logoff and logon are the only ways to stop it. The exception isn’t thrown, and the dll is loaded instead. It may function for a few days before breaking again.
Is there something like this out there, and if so, what is the solution?
Asked by xll
I’m sorry for being late to the party, but I encountered this problem soon after downloading the latest x86/x64 today (version 22.214.171.124). My local IIS in VS2012 is set to operate in 32-bit mode by default, and there’s no easy way to change it to x64. My production server runs on a 64-bit operating system.
Anyway, I attempted to install the NuGet package into a DLL project and received the following error. I have to install it to the main site project as well in order for it to operate. Even if it has nothing to do with SQLite classes.
SQLite, I believe, uses the entry assembly to determine which Interop version to load.
Answered by Kugel
This was caused by a dependency on Sqlite in a dll I was using (configured in NuGet with only the Sqlite core package.). Except for ‘SQLite.Interop.dll,’ the project compiles and copies all Sqlite dlls (both x86 and x64 folder).
The answer was straightforward: simply add the System. Data. The dll-s will be copied if you add the SQLite.Core package as a dependency (through NuGet) to the project you’re working on.
Answered by Marin
As a result, the deployment does not copy down the Interops after adding the NuGet. You can add this to your csproj file to correct the problem:
<PropertyGroup> <ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles> <CopySQLiteInteropFiles>false</CopySQLiteInteropFiles> <CleanSQLiteInteropFiles>false</CleanSQLiteInteropFiles> <CollectSQLiteInteropFiles>false</CollectSQLiteInteropFiles> </PropertyGroup>
You can see what these are doing particularly if you look at the source for NuGet for SQLite. This allowed me to get an ASP.Net Core deployment to work.
Answered by b.pell
When I used SQLite in a WPF project with an Any CPU platform target, I ran into the identical issue. I was able to repair it by following these steps:
You could also simply specify the platform target to x86 or x64. This issue appears to be caused by the System.Data.SQLite library locating the ‘SQLite.Interop.dll’ file using the platform target.
If the project designer is unavailable, open the project (*.csproj) file in a text editor and replace the value Prefer32Bit>false/Prefer32Bit> in the PropertyGroup>…/PropertyGroup> tag with the value Prefer32Bit>false/Prefer32Bit>.
<PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>[Set by Visual Studio]</ProjectGuid> <OutputType>Exe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>[Set by Visual Studio]</RootNamespace> <AssemblyName>[Set by Visual Studio]</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <FileAlignment>[Set by Visual Studio]</FileAlignment> <!--Add the line below to your project file. Leave everything else untouched--> <Prefer32Bit>false</Prefer32Bit> </PropertyGroup>
Answered by Caleb Kiage
This is how I solved the problem in my project.
It was running fine until a coworker submitted his edits and I got the error “Unable to load DLL ‘SQLite.Interop.dll’.”
This was in the NON-WORKING version of the project’s.csproj file:
<ItemGroup> <Content Include="x64\SQLite.Interop.dll" /> <Content Include="x86\SQLite.Interop.dll" /> </ItemGroup>
And here’s what was in the WORKING version:
<ItemGroup> <Content Include="x64\SQLite.Interop.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="x86\SQLite.Interop.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup>
I didn’t get the exception after reverting back. The DLL files were extracted and placed in the Debugx64 (etc) directories.
Answered by Wil
Post is based on https://stackoverflow.com/questions/13028069/unable-to-load-dll-sqlite-interop-dll