Reputation: 323
I'm building a setup for a web application using Windows Installer XML. Most of the files are gathered using the heat tool within a custom build file. This includes the Web.config which is modified at install-time.
Is there any way to prevent this file from being overwritten if it exists - for example if I'm running an update?
Upvotes: 0
Views: 397
Reputation: 20780
If the MSI installs the config file and then a custom action or an app modifies it then it won't be replaced on an update because of the file overwrite rules.
It will be removed if you uninstall it, and that includes a major upgrade that has RemoveExistingProducts early in the upgrade.
When MSI installs data files it sets creation date and modify date to be the same so that it can detect if the file has been modified after it has been installed on the system. Modifying the web.config file during the install (presumably after MSI has put it on the system) is code that modifies the file. This stuff is easy to test. Install a data file with MSI and examine the dates, then modify it and examine the dates again. Similarly, after your install look at the modify and create dates of the config file - they should be different and so an MSI update won't replace it as described before.
Upvotes: 2