1

I've created a simple windows form project that creates a database (SQLite) and displays data on the window.

I've downloaded System.Data.SQLite package. During debug, the system shows the database correctly.

Application During Debug

Now I want to create an installable application to share with friends, so I added a setup project on the solution.

The Solution for the App

When I run the installation from the setup project, nothing happens. I get the following error from Windows Event Viewer

Application: SimpleDB.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.PrivateInitialize(System.String) at System.Data.SQLite.SQLiteLog.Initialize(System.String) at System.Data.SQLite.SQLiteConnection..ctor(System.String, Boolean) at System.Data.SQLite.SQLiteConnection..ctor(System.String) at SimpleDB.SQLiteDatabase.ExecuteNonQuery(System.String) at SimpleDB.FormMain..ctor() at SimpleDB.Program.Main()

The Application installs in Program Files(x86), but it doesn't show any window when I click on the installed executable. These are the files there:

enter image description here

Am I missing something?

When I don't use dependencies (eg SQLite), the program is correctly installs and shows a window.

2
  • I think it may be because you did not package SQLite.Interop.dll when you packaged the msi. Many times "System.DllNotFoundException" is not because the dll does not exist, but because it cannot be found. SQLite.Interop.dll helps locate other sqlite packages. You can try to package SQLite.Interop.dll into msi. Will there still be errors in the future? Commented Dec 4, 2023 at 9:37
  • Thanks, I copy pasted SQLite.Interop.dll into the installation folder. When I examine Windows Event Viewer, I see a System.BadImageFormatException exception. Commented Dec 5, 2023 at 7:21

1 Answer 1

1

What worked for me is:

  1. Set the build property for preferring 32-bit enter image description here

  2. Add SQLite.Interop.dll (the one in the bin/Release/x86 folder, you can also use debug) to the main project

  3. Add SQLite.Interop.dll (the one in the bin/Release/x86 folder, you can also use debug) to the setup project

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.