S
S
SMARTi2015-07-28 20:23:06
.NET
SMARTi, 2015-07-28 20:23:06

dll missing error when using sqlite-net in c#, how to fix?

Installed using NuGet package manager System.Data.SQLite and sqlite-net, but when creating connection using sqlite-net:

SQLiteConnection conn = new SQLiteConnection("dbname.db", false);

An exception occurs in SQLite.cs:
An unhandled exception of type 'System.DllNotFoundException' occurred in SQLiteTest.exe
Additional information: Cannot load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
dll sqlite3.dll added to the project, tried different bit depths, nothing changes. What could be the reason? In which direction to look?
I did not fully understand how it happened, but now a new exception occurs:
Cannot load DLL \"sqlite3\": This operation is only valid in the context of an application container. (Exception from HRESULT: 0x8007109A)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Stanislav Makarov, 2015-07-28
@SMARTi

Make sure to install this https://www.nuget.org/packages/System.Data.SQLite/ or this https://www.nuget.org/packages/System.Data.SQLite.Core/ package. sqlite-net is of no use to you, if these are already installed, try to remove it, it may be causing a conflict. A properly installed System.Data.SQLite package should be self-contained in terms of assembly (should copy the necessary files itself).

V
Vladimir Martyanov, 2015-07-28
@vilgeforce

"added to the project" - I'm afraid EXE knows absolutely nothing about the project. Try to put the corresponding DLL in the directory from where the EXE is launched.

V
Vitaly Pukhov, 2015-07-29
@Neuroware

check that the working directory is correctly specified, probably the application "looks" in the wrong folder in which the dll is located

A
Artem, 2015-08-01
@devspec

Perhaps the problem is that the required version of Visual C ++ Redistributable is missing on the computer (depending on the version of sqlite)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question