VS2012EXPRESS Ado.Net SQLite missing DLL issue-Collection of common programming errors
I’m trying to work out how to use ADO.Net Sqlite in VS2012 Express with no luck.
Things im doing from begining:
- Starting new project and installing “System.Data.SQLite (x86/x64)” via NuGet for solution.
- Adding
using System.Data.SQLite;
to directives. -
Writing simple code like:
SQLiteConnection sql_sck = new SQLiteConnection(“Data Source=test.sqlite;Version=3;New=False;Compress=True;”);
Everything seems to look okay, VS recognize class names and changes their colors. However after running the program, in the sql_sck… line, exception is raised – about missing dll ?
An unhandled exception of type 'System.DllNotFoundException' occurred in System.Data.SQLite.dll
Additional information: Could not load DLL 'SQLite.Interop.dll': Could not find specified module. (Exception HRESULT: 0x8007007E)
Any ideas how can I make this work ? Is there anything I’ve done wrong / any steps missing ?
-
Somewhere Visual Studio will have created SQLite.Interop.DLL. You need to find that DLL and copy it to the same directory as your application’s executable.
I usually add Interop DLLs to my project as a reference and flag them for copying to the output directory in order to ensure that others that use the projects don’t forget the manual step.