Problems installing over the top of existing product
I have a product that's packaged as an MSI. When my customers install a new version of my product over the top of an existing version it's not working nicely, as explained below. My question is: how I can change my MSI so that installing over the top will always do a full uninstall of any existing version beforehand?
The detail is:
I have a product with a variety of versions deployed at various different companies. About once a year each of my customers would receive a new version of my product and deploy to their company's workstations. The people responsible for deployment would prefer they can install the new version over the top of the old version, instead of having to include an uninstall step in their install package.
The msi install creates and writes some files to [CommonApplicationData]\MyApp folder. During execution the application creates more files in [CommonApplicationData]\MyApp folder. During uninstall I need to delete all these files. Since they're not installed by the msi they aren't automatically uninstalled, so I created a vbs script that deletes that folder and anything else in it. I put a command to execute that vbs in ExecuteDeferred:
If REMOVE="ALL" Then
call VBScript From Installation (MyApp_UninstallCleanup) <<-- this is my script
So far so good and it works fine when installing & uninstalling. However, if I install a new version of my product over the top of an existing version it appears things happen in this order:
a) install new version, creating various files in [CommonApplicationData]\MyApp folder, and in [Program Files]\MyApp\..., overwriting files of old version
b) run my vbs, deleting the [CommonApplicationData]\MyApp folder
The product itself is pretty small so it would be fine if the installer always removed previous versions entirely before installing the new version. There are no user settings on the workstation that need to be retained and the file sizes aren't large. Hence for simplicity I want the previous versions to be uninstalled rather than updated with only the bits that have changed.
Is there a way I can change my new MSI so that it will uninstall previous versions first?
Notably, I have many companies who have the existing version of the MSI installed that contains the custom vbs. So the solution really needs to be one that can cope with the existing installed msi.
I've used Wise Installation Express 7.0 to create the MSI.