Always perform removal/reinstallation during upgra

2020-06-21 03:06发布

问题:

I'm having a little trouble understanding how InstallShield treats upgrades.

What I want is to be able to increment the version number on the installer, recompile, and distribute my installer. This should automatically remove any previous version of the application, and install the latest version (and it should be presented to the user as an "upgrade").

This is a very straightforward installer, it just takes output from a few Visual Studio projects (an application EXE, some DLLs and so forth) and installs them all into Program Files. There is only one feature and it is always installed.

I don't want to change the upgrade code of the product because I would then have to create new upgrade paths (one for each previous version), which is messy.

I've tried this before (incrementing the version number, but not changing either the Product Code or the Upgrade Code), but each time I do, when I run the installer to "upgrade" the product, it says "Resuming the wizard for [ProductName]", and sometimes some of the files are not replaced with their newer counterparts from the newer installer.

I am not incrementing the "revision" number of the version number. I know that's ignored. Typically, I will try something like 2.0.3 => 2.0.4.

How can I set up InstallShield so that it automatically removes any previous versions, installs the newest version, and presents this to the user as an "Upgrade" or "Update" if they already have a previous version installed? If not, it should install like normal (an "Install", not an "Update").

I'm using InstallShield 2013 Pro (Version 20 SP1), and I stick to using the InstallShield Editor within Visual Studio 2010.

回答1:

What you need is a major upgrade. This is essentially an automatic uninstall of the existing version and reinstall of a new version done as one operation by the Windows Installer Engine itself after you author the Upgrade table of the MSI, set a new ProductVersion and change the package and product code. This is the least error prone update mechanism in Windows Installer. To implement a major upgrade in Installshield go to the Upgrades view and add an upgrade item. Then you follow the GUI wizard or pages and set upgrade options. I will see if I can find a better link for you now, but this should get you going.

To really understand Windows Installer Upgrades you should read this book chapter. Or this Microsoft MSDN page.

Just for completeness: a minor upgrade - which is upgrading the existing install without uninstalling it, is generally more difficult to get right in the beginning. A number of technical restrictions apply. Here is a very good summary of what is required for a minor upgrade to work (as well as other details): http://www.installsite.org/pages/en/msi/updates.htm



回答2:

In that case you can use COM automation to automate the release process using Javascript or VBScript. This is a familiar process if you have automated other products before such as Word or Excel. Here are some resources to get going:

  • Look, No Hands: InstallShield’s Automation Tools
  • Automation Interface
  • Installshield Build Automation

I made a build process once using this kind of VB scripting and also a build tool called FinalBuilder that took care of the rest of the build process. I guess FinalBuilder might have an action for Installshield by this point so you can bypass the scripting altogether. I don't know for sure. Just wanted to link to the GUI so you can see what the tool looks like. Further screenshots.