Video Screencast Help
Search Video Help Close Back
to help
Not able to make it to Vision this year? Get a sampling in the Best of Vision on Demand group.

Always overwrite existing files

Updated: 22 May 2010 | 4 comments
nkinstall's picture
0 0 Votes
Login to vote

We are installing a large number of textbased configuration files that our users modify after install. During install we take backup of these directories, before the new files are installed to secure our users work. We haven't found a way to have MSI not uninstall the modified files, so therefore we don't remove them on uninstall. The problem is then that these files are not overwritten by a new install (after uninstall). Overwriting works by using REINSTALLMODE as a parameter to msiexec, but we want it to be solved by a normal install without any extra parameters to msiexec.

Any ideas how this can be solved?
How to have MSI not uninstall modified files?
How to always overwrite files that exists in the installation directories?

Thanks

Discussion Filed Under:

Comments

EdT's picture
08
Jun
2009
1 Vote +1
Login to vote

Options

There is no generic method to have MSI not uninstall modified files - the only real solution is to identify the files that will be modified, and ensure that the components that install these files are marked "permanent" (ie do not remove on uninstall).

Equally, the default behaviour of MSI file versioning logic is not to overwrite data files where the modify date is newer than the create date. The only effective solution to ensure that the files are overwritten during an install, is to delete the files first. This can be done by adding the files that you want to delete, via Installation Expert, and select the drop down option "Delete on install", Since the "RemoveFiles" action is executed before the "Installfiles" action, this ensures that the data files are deleted before the new ones are installed, so no file versioning issues are ever encountered.

Just bear in mind that any files which are open (ie locked) by an application, may not be possible to delete, and therefore you should ensure that any existing instance of your application which you may be upgrading, is not running when the upgrade is installed. There are various custom action solutions which check for running processes, but I won't go into this here, as it's not clear if you will ever need them.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

nkinstall's picture
25
Jun
2009
0 Votes 0
Login to vote

Thanks for your

Thanks for your reply!

Regarding our backup solution which now happens on install (by doing a copy of *.* on the relevant directories), we want to try doing it on uninstall (before the files are removed). For the Move and Remove commands we can choose to do them on install and/or uninstall but there is no such option for copy.

How can we do a copy of *.* from one catalog to another catalog on uninstall before the files are removed?

EdT's picture
25
Jun
2009
0 Votes 0
Login to vote

Use a custom action

You can perform any copy operations on uninstall by using a custom action, with the condition REMOVE="ALL", so that it only runs on uninstall.

Your choice of custom actions includes VBScript, so it would be quite trivial to create a script that makes a copy of any resources you wish to preserve before you uninstall. Just make sure that the custom action is sequenced early, as there is no point trying to back up resources that have already been uninstalled!

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Shaun Wilkinson's picture
17
Jun
2009
0 Votes 0
Login to vote

I have rasied the same issue

I have rasied the same issue over the years.
The feature Edt details is brillaint and does the job.

Only problem I have found over the years is if you wish to delete all files from the folder bar 1-10 of them. Have written vbscript to move the files back in after the installation is complete.