SQLite dll for x86/x64 architectures SQLite dll for x86/x64 architectures sqlite sqlite

SQLite dll for x86/x64 architectures


There are various options for using SQLite from a .NET assembly. Your first step is to move to something newer than the ancient 1.0.65 version. Current versions can be downloaded from here: http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki or via the SQLite NuGet packages.

If you need to be able to run under both 32-bit and 64-bit, one option is to use the native library pre-loading option, where you distribute the native binaries in separate directories, so that it looks like this:

  • \App.exe (optional, managed-only application executable assembly)
  • \App.dll (optional, managed-only application library assembly)
  • \System.Data.SQLite.dll (required, managed-only core assembly)
  • \System.Data.SQLite.Linq.dll (optional, managed-only LINQ assembly)
  • \x86\SQLite.Interop.dll (required, x86 native interop assembly)
  • \x64\SQLite.Interop.dll (required, x64 native interop assembly)

Another option is to build two versions of your app, and in each version you reference the appropriate mixed-mode assembly. You'd then end up with two versions, but they're a bit simpler to deal with since you don't need the extra subdirectory and native *.Interop.dlls.

In these cases you'd need no code differences or optional compilation between 32-bit and 64-bit. Installing from the different NuGet packages will probably get you started most easily.

A final option is to go for the managed-only clone called C#-SQLite: https://code.google.com/p/csharp-sqlite/. It's a port of the SQLite engine to managed C#, so the whole thing runs as AnyCPU and the bitness is not an issue.


I had the same problem few year ago and for me the best solution is:

  • download the latest version of the library
  • in your bin path put only the System.Data.SQLite.dll and eventually System.Data.SQLite.Linq.dll
  • put the x86 SQLite.Interop.dll library into c:\Windows\SysWOW64
  • put the x64 SQLite.Interop.dll library into c:\Windows\System32
  • compile your project as Any CPU referencing only System.Data.SQLite (the dll into your bin path)
  • enjoy

In this way the .NET framework will automatically load the correct (x86 vs x64) library during the runtime without registering anything in GAC or similar.

Hope this helps.


No there isn't one.

That's because these *.dlls are just wrappers for native c/c++ *.dll's. And a 32 bit, .NET application have to use the 32 bit c/c++ dll and a 64 bit, .NET application have to use the 64 bit c/c++ dll.

I haven't used vb.net for a long time, I'm not sure if you can configure the target platform like you can do in c#. If you can, you should do so and take the right interop dll. And you should decide if you need 32 bit or 64 bit.