Video Screencast Help

Problems installing over the top of existing product

Created: 04 Jul 2012 • Updated: 04 Jul 2012 | 2 comments

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:

...
RemoveFiles
RemoveFolders
CreateFolders
MoveFiles
InstallFiles
PatchFiles
If REMOVE="ALL" Then
    call VBScript From Installation (MyApp_UninstallCleanup)    <<-- this is my script
End
DuplicateFiles
BindImage
CreateShortcuts
...

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.

thanks!!

Rory

 

Comments 2 CommentsJump to latest comment

EdT's picture

If you have used the standard Wise template for your installs, then the RemoveExistingProducts action is sequenced at the end of the InstallExecute sequence. Although technically this is the most "efficient" placement, unless you have very carefully run UpgradeSync when creating your new package to upgrade the old, the end result is usually one of missing files or other aberrations.

The fix is to re-requence the RemoveExistingProducts action so that it runs between InstallValidate and InstallInitialize. That ensures that the old app is removed entirely before the new version is installed.

Look up "RemoveExistingProducts" in the help file MSI.CHM for a more detailed explanation of the options for positioning this action.

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

Rory K's picture

You're right - RemoveExistingProducts is right at the end. Will move it as you advise and test things out.

Many thanks!!