1

I am developing a WPF desktop application that uses a SQLite DB and this is in my App_data folder which is fine while a run it in debug but how do i include a DB file when i build my application and run it on another computer? do i need to build an installer for my app to create a copy of the DB in a location on the users machine that has read/write access?

Thanks

1
  • 1
    Yes, this location is usually on Windows7/8: C:\ProgramData. You create your app folder there for the SQLite database. In your code refer to your database from here: Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) Commented Apr 3, 2015 at 15:00

2 Answers 2

1

You could create the database in your initialization routines if the database doesn't exist. You can include the location and other settings in your app config. Check this link out: Create SQLLite Database and Table

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

Comments

1

It sounds like you want to have your SQLite database included in your project output including all the records that were added (i.e. you do NOT want to deploy an empty copy of the database, but rather the same data that you were working with during development).

To accomplish this, add the SQLite database to your project and set the build action to "copy to output location". In your config file, you can then set up the connection string to look for the file in the application directory.

Now, every time you build the project, a fresh copy of the database will be placed in the output directory.

1 Comment

Yes i want to add in some reference data that my application will use and also the application will save user inputed data back to this database.

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.