I am able to build and execute on my development box my Winforms applicaiton, however I run into this error, when I attempt to run my application on another clean box (a VM).
Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.DllNotFoundException
at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(System.Data.SQLite.SQLiteConfigOpsEnum)
at System.Data.SQLite.SQLite3.StaticIsInitialized()
at System.Data.SQLite.SQLiteLog.Initialize()
at System.Data.SQLite.SQLiteConnection..ctor(System.String, Boolean)
at System.Data.SQLite.SQLiteConnection..ctor()
at DittoSql.SQL..ctor()
at MyApp.Program..cctor()
Exception Info: System.TypeInitializationException
at MyApp.Program.Main(System.String[])
I used Nuget to add SQLite to my project.
Sadly, the event viewer log does not provide what DLL that the system cannot find. I did research and the one thing that turned up is .Net compatibility. I was at 4.6.2, which on SQLite v1.08 does not support, so I downgraded to .Net 4.6, which is listed.
Both machines run Windows 10 X64 with all the latest updates.
Here is a screenshot of the app folder showing the files.
UPDATE
Based on the comment from @Plutonix, here is a screenshot showing the references to my project. Missing is System.Data.SQLite.Core
, which contains the interop files. There are different versions for each .Net version and OS type, so I cannot just browse for the folder inside the packages folder, besides that is a terrible hack. There should be a clean way to add the reference.
For the record, I briefly thought of that file, but I did not see it or the core and figured version 1.08 does not use it, but I guess that it does.
NOTE: I copied the SQLite.Interop.dll
file manually to the VM and the project loaded. Procman
was not that helpful, too much information perhaps, though I filtered out everything but my app. Anyways, the problem is how to get a reference to the SQLite core.
UPDATE 2
Uninstalling all sqlite components from NuGet and then reinstalling SQLite does not add reference the core in the project, annoyingly.
UPDATE 3
This SO article (in the answer) states the problem. Basically, NuGet for whatever messed up reason correctly "requires" the core, but then does nothing with it. As such, NuGet does not distribute a required file. I saw the answer to "copy" the X86/X64 folders, etc.
I, for one, name that as a serious defect/bug in the NuGet SQLite package. Yes, this question becomes sort of a duplicate of the referenced question, if you know the answer, but I did not, so it is not. I never received any error message on the interop DLL.