Unable to load SQLite Interop DLL

0

I am trying to install SQLite in my Windows 10 machine. I want to use SQLite database for my project. The target framework is .net 4.0 and am using VS2010.

SQLite .NET download page has the following:

Setups for 64-bit Windows (.NET Framework 4.0) sqlite-netFx40-setup-bundle-x64-2010-1.0.104.0.exe (14.27 MiB) This setup package features the mixed-mode assembly and will install all the necessary runtime components and dependencies for the x64 version of the System.Data.SQLite 1.0.104.0 (3.15.2) package. The Visual C++ 2010 SP1 runtime for x64 is included. The .NET Framework 4.0 is required.

sqlite-netFx40-setup-x64-2010-1.0.104.0.exe (14.26 MiB) This setup package will install all the necessary runtime components and dependencies for the x64 version of the System.Data.SQLite 1.0.104.0 (3.15.2) package. The Visual C++ 2010 SP1 runtime for x64 is included. The .NET Framework 4.0 is required.

When I am installing using sqlite-netFx40-setup-x64-2010-1.0.104.0.exe and using SQLite in my project then I get error "Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". To solve it I have to copy the interop dll file in the debug folder.

However when I install using sqlite-netFx40-setup-bundle-x64-2010-1.0.104.0.exe then I can run my program without the need for interop dll. It does not give any error and only System.Data.SQLite.dll is needed.

I wonder why is this happening ?

.net
vb.net
sqlite
visual-studio-2010
asked on Stack Overflow Jan 12, 2017 by Greatchap

1 Answer

0

1- Make create a lib in the root of your project then copy the SQLite.Interop.dll inside.

Add this to your .csproj file:

  <ItemGroup>
    <ContentWithTargetPath Include="lib\SQLite.Interop.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <TargetPath>SQLite.Interop.dll</TargetPath>
    </ContentWithTargetPath>
  </ItemGroup>
answered on Stack Overflow Oct 23, 2018 by Shuaib

User contributions licensed under CC BY-SA 3.0