MaYaN MaYaN - 2 months ago 26
C# Question

Why am I getting DllNotFoundException when adding SQLite Nuget Package to LINQPad?

I have added the

System.Data.SQLite.Core
NuGet package to my LINQPad 5 Query (Premium) and then try to execute the following:

new SQLiteConnection(":memory:").Dump();


But I get:


DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll': The
specified module could not be found. (Exception from HRESULT:
0x8007007E)


How can I tell LINQPad where to find the SQLite Native DLLs?

Please note I do not want to use the IQ Driver.

Answer

This library is not referenced in the standard way, because it's native and requires different images for X86 and X64.

A workaround in LINQPad is to locate the following folder:

%localappdata%\LINQPad\NuGet.FW46\System.Data.SQLite.Core\System.Data.SQLite.Core.1.0.99.0\build\net46

and copy the X86 and X64 subfolders into the folder where LINQPad.exe is located.