Search code examples
c#sqlitemonodllnotfoundexception

System.DllNotFoundException on Mono SQLite


I've been trying to figure this out lately. It is working on my Windows machine, where I got SQLite from NuGet, but...

When I put System.Data.SQLite.dll and SQLite.Interop.dll straight from my Windows machine into Linux server it says that SQLite.Interop.dll is not found, but I am sure I see it next right to executable.

Then I tried to compile System.Data.SQLite.dll with /p:UseInteropDll=false, but with no luck. This time it says that System.Data.SQLite.dll is not found.

What is this "not found" mystery?


Solution

  • Use Mono.Data.SQLite.dll on Linux. Take a look at the Mono manual to using SQLite on Linux or build the System.Data.SQLite.dll on Mono.

    You can also map the DLL:

    <configuration>
      <dllmap dll="sqlite" target="libsqlite.so.0" os="linux"/>
      <dllmap dll="sqlite" target="libsqlite.0.dylib" os="osx"/>
      <dllmap dll="sqlite3" target="libsqlite3.so.0" os="linux"/>
      <dllmap dll="sqlite3" target="libsqlite3.0.dylib" os="osx"/>
    </configuration>