Search code examples
c#winformssqlitedeploymentsetup-project

sqlite database with winforms deployment


I am fairly new to this deployment of sqlite database with C# winforms application. I created a Setup project with the following Application Folder contains Primary output(.exe file) The program has the System.Data.sqlite as its dependencies.

In the regular project(not set up), database is included in bin->Debug->Appdata->Test.DB

 <connectionStrings>
    <clear />
  <add name="RConnString" connectionString="Data Source=App_Data\Test.db;Compress=True;Version=3"
      providerName="System.Data.Sqlite" />

  </connectionStrings>

For Installation: Where would the database and its related dependencies go(system.data.sqlite) Currently, this program is installed at C:\Programfiles... Did not include Database yet.

What is a good place to ship this sqlite Db. Also, how would I do it. Where in the Setup project do I place it. Do I need a custom install?
We have Windows XP, Win 7 users


Solution

  • The ideal place to put this, if it is per-user data is in a directory under the roaming profile location, usually C:\Users\john\AppData\MyApplication or something. If it is machine-wide data (not user-specific) then it should go under C:\ProgramData\MyApplication.

    I'm not sure what type of installer you're using but it should have a way to specify these locations generically (i.e., "User data directory" or something like that).

    The location where you do not want to put your database file is in the same install location as your application executable(s), unless you are only going to read from it. Anything that is going to get written to needs to go in one of the two above locations.