How to tell MSI not to update existing file in setup and deployment project in VS2005?

I have a setup and deployment project in VS2005. One of the files I install is a SQLite data file.

I am about to release a new version for the software, but I found that if I run the update on an existing installation, it will overwrite the data file.

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

I am trying to set the Permanent property for this file to True, but to no avail.

Any suggestions?

+2


source to share


3 answers


Ok, here's the workaround I used:

  • In my setup project, I renamed my blank database file from Database.db to Database-blank.db.
  • In my application, I check for the absence of Database.db and copying Database-blank.db to Database.db if so.
  • then just load the existing Database.db


This way I can ensure that the local copy of the data file (Database.db) is not replaced by newer versions of the software.

+1


source


In MSI, the best way would be to write an entry in the Update table identifying if this is an update install and setting the property if any. Then put the datafile in the component and put the condition on the component. Alternatively, make an entry in the AppSearch table , checking for the existence of the file (via the DrLocator table ).



I don't know if the setup and deployment project supports all of this. So, as a fallback, install the file with a different name and then create a custom action that conditionally copies the file.

0


source


Because configuring VS2005, when upgrading the program, it will first uninstall the original installed instance and then install the new one, so that for that the file will be deleted every time.

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

now after the file is updated, it will not be overwritten, but your application cannot work with this file because it is read-only, so when you start your application check if the data file is actually cleared and uncheck it.

0


source







All Articles