Monthly Archives: March 2009

Wix – How to forcibly overwrite pre-existing files during installation.



The fly in the ointment

Wix v2 is a pretty nifty tool but since there are a few nasty surprises in store for those who don’t know exactly what it does behind the scenes. More importantly, the Windows Installer tries to perform the intelligent thing of not installing files if the source and destination are exactly the same. This is done by comparing a checksum of the source and destination files. If the checksums match, the file isn’t overwritten at all!

Why would you want to overwrite the same file?

There are a few cases where you might need to do this. For example, if your application relies on the date-time stamps of files for copy-protection or versioning (amongst other things), the checksum comparison will ensure that files having the same checksums are not overwritten. This is not what you might have expected from an installer as one would logically (and sensibly) expect a well behaved installer to blindly overwrite pre-existing files on disc.

It thus becomes impossible for one to overwrite files that are exactly the same even though their timestamps do not match!


Fortunately enough there is a “directive” which can override this behaviour. Simply add the following line to your .wxs file –

<Property Id=”REINSTALLMODE” Value=”amus”/>


Admit it! Quick fixes aren’t usually as simple as this little tit-bit! I was lucky to come across this solution on the Internet (after a long and arduous journey) and decided to put it on a page exclusively devoted to this topic. Hope that someone finds it helpful! :)