views:

173

answers:

3

Hi,

I've got a Setup & Deployment Project in VS2005. One of the files that i'm installing is a SQLite data file.

I'm about to release a new version for the software, but i found that if i run the update on existing installation it overwrites the data file.

I've got an updated data file in the setup project so it's newer than already installed, but i don't want to overwrite it.

I've tries setting the Permanent property for that file to True, but to no avail.

Any suggestions?

A: 

In MSI, the best way would be to make a record in the Upgrade table, determining whether this is an upgrade installation, and setting a property if it is. Then put the data file in a component, and place a condition on the component. Alternatively, make an entry in the AppSearch table, checking for the presence of the file (through the DrLocator table).

I don't know whether a Setup & Deployment project supports any of this. So as a fallback, install the file with a different name, and then create a custom action that copies over the file conditionally.

Martin v. Löwis
A: 

Because VS2005 setup when upgrading a program first it remove the original installed instance and then install a new one, so for that the file will be removed every time.

to avoid replacing or overwriting the file I suggest the following: 1- mark the file as readonly in the setup project. 2- mark the file as permanent in the setup project.

now after upgrading the file it will not be overwriten, but your application can't deal with this file because it's readonly, so in the startup of your application check if the datafile is readonly uncheck it.

Wael Dalloul
Thanks for you input, Wael.Actually, id does not remove the file if it was changed since installation.I've tried your suggestion with Permanent and ReadOnly, but it still overwrites the file.
Muxa
A: 

Ok, here's a workaround that i've used:

  • In my setup project I've renamed my blank database file from Database.db to Database-blank.db.
  • In my app i'm checking if Database.db is missing and copying Database-blank.db to Database.db if it is.
  • then just load existing Database.db

This way i can ensure the local copy of the data file (Database.db) does not get replaced by newer versions of the software.

Muxa

related questions