Search code examples
.netsqliteiismixed-mode

New SQLite mixed assemblies


Previously .NET SQLite libraries were available from http://sqlite.phxsoftware.com, but they have recently been taken over by the main SQLite team and have moved System.Data.SQLite Download Page. The new packages don't seem to contain mixed assemblies anymore (single assembly containing sqlite3.dll and the .NET wrapper).

The new package comes with the .NET DLL and SQLite.Interop.dll which based on the documentation is not needed on the desktop but my application fails to load with Unable to load DLL 'SQLite.Interop.DLL': The specified module could not be found.. I have tried running the application under IIS/IIS Express with apppool set to 32-bit.

I have tried copying the SQLite.Interop.dll file into the bin folder, the system folder, and the ASP.NET temp folder but still get the same error.

Are there mixed assemblies for new releases available anywhere? If not, is there a way to fix the Unable to load DLL 'SQLite.Interop.DLL error?


Solution

  • I found the solution. The problem was due to a known issue with SQLite.Interop.dll.

    This is the workaround from that worked for me.

    Using Dependency Walker from http://dependencywalker.com/ to look at SQLite.Interop.dll (x86 and x64) shows that it depends on MSVCR100.dll.

    The old 1.0.66.0 version of System.Data.SQLite.dll does not have this dependency. With the current build, we would have to redistribute that MSVCR100.dll also or run an installer from Microsoft.

    Solution: From: Missing msvcr100.dll

    Use static linking. In the SQLite.Interop Visual Studio project. Go to this Properties setting: Project -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library and change the value to Multi-threaded (/MT). (The current source code (1.0.71.0) has Multi-threaded DLL (/MD) which causes the dll to rely on MSVCR100.dll and the DLLImport (and LoadLibary()) to fail when users do not have it).

    I believe static linking should be changed so it is the default for SQLite.Interop.dll.