Patrick Thorpe
Patrick Thorpe

Reputation: 380

How do I include my SQLite database in my published vb.net project?

I have been working on a project in vb.net which uses an SQLite database (Patient_Database.db). The connection between the software and the database works when I debug the program, and the database is stored in the project folder, and automatically transferred to the debug folder, as shown:

Database in solution explorer

Database in debug folder

However, when I publish the project in order to make an executable, the database is not included in the publication. I have spent all day trying various walkthroughs online but I just don't seem to be able to get the publication to include the database or the necessary SQLite.Interop.dll file in the x64 and x86 folders in the Debug folder.

My published project looks like this:

Publication

With the following inside the Application Files folder:

enter image description here

I realise that I might be doing something stupid, or that I might just be going about this in the entirely incorrect way. If anyone could correct my flawed methods that would be very helpful!

Thanks

Upvotes: 0

Views: 5000

Answers (2)

Neshat Ademi
Neshat Ademi

Reputation: 1

enter image description here Just add a folder "Database" in your project and insert there your file.db

Then on Publish "Application files" include as dataFile your file.db

enter image description here

enter image description here

Upvotes: -1

Alex B.
Alex B.

Reputation: 2167

In regards to the comments some visual help for you:

Add DB to published files 1

  1. Open project properties of your main project
  2. Select the Publish tab
  3. Choose Application files...

Add DB to published files 2

  1. Find your db file
  2. If it is not listed, select Show all files first
  3. Set the Publish Status to Include
  4. The Download Group should be Required.

After a new publish the DB file should be contained in the Application Files on your server.

EDIT: To make the file visible for the published application files you have to set its 'Build Action':

Make DB file available for publish

Upvotes: 2

Related Questions