Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include SQLite database with Winforms App Center release?

I have a Winforms desktop app written in C# and have successfully setup my Azure DevOps pipeline to build and distribute my app to the App Center. The app creates and edits/updates local SQLite database files, but I would like to include a couple of sample databases that already contain valid data so the users can demo the app's other features without having to first create and populate their own databases.

How can I include these SQLite db files in my release? I'm not seeing a way in Visual Studio to add an SQLite project to my solution, even though I do already have the System.Data.SQLite.Core package installed with my solution.

Would I be better off just writing code to generate the sample databases with all the sample data and then connecting that code to a GUI menu option? That would also allow the contents of the sample databases to be version controlled, as I'm assuming there's no way to diff an included binary DB against previous versions.

like image 600
user2150989 Avatar asked Dec 05 '25 17:12

user2150989


1 Answers

The solution is as follows:

In Solution Explorer, right click the project name (not the solution name), then click "Add" -> "Existing Item". Navigate to the database (or the file you want to include), then click "Add". Once the file has been added to the project, select it in the Solution Explorer and in the Properties window below, make sure the "Build Action" and "Copy to Output Directory" are set to your preference ("Content" and "Copy if newer" in my case). From that point onward, the files will be included in any release.

like image 158
user2150989 Avatar answered Dec 07 '25 19:12

user2150989



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!