0

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

Patrick Thorpe
  • 140
  • 4
  • 16
  • Possible duplicate of [How to publish my windows form application with database](http://stackoverflow.com/q/20049350/1070452) – Ňɏssa Pøngjǣrdenlarp Jul 03 '16 at 20:40
  • The selected answer for that question says: "You will need to deploy your database as "IncludeData" in the application settings." However after trying for the past 15 minutes or so I don't seem to be able to locate an application settings or an IncludeData setting. – Patrick Thorpe Jul 03 '16 at 20:56
  • Go to the Publish tab and click the Application Files button. – jmcilhinney Jul 04 '16 at 00:56
  • Hi. I thought this might be the answer, and I have tried it. However, the database is not listed; even when I press "show all files" – Patrick Thorpe Jul 04 '16 at 20:16

2 Answers2

2

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

Alex B.
  • 2,145
  • 1
  • 16
  • 24
  • Hi. I thought this might be the answer, and I have tried it. However, the database is not listed; even when I press "show all files" – Patrick Thorpe Jul 04 '16 at 20:11
  • great visual demo but this is the only step that you need: i.e., Right click the db file in solution explorer then set its Build Action to CONTENT as demonstrated here https://i.stack.imgur.com/nfCP9.png. – user3267567 Oct 08 '20 at 06:10
-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

Milad Faridnia
  • 9,113
  • 13
  • 65
  • 78