Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
993 views
in Technique[技术] by (71.8m points)

windows installer - InstallShield fails because of a bad uninstall

I'm building an InstallShield project, which does a [Major Upgrade][1] to an existing install (i.e. I changed the Product Code while retaining the Upgrade Code).

The uninstaller of the previous version (which is already deployed) is broken, and fails to run some scripts. This in itself is not a serious problem, as all relevant files are removed beforehand.

The problem is that when the new installer attempts to uninstall the previous version, it aborts when the uninstaller fails. I've tried setting the 'Continue On Failure' flag (Media-->Upgrades-->MajorUpgrade-->Advanced-->Additional Settings), but with no effect.

Questions:

  • Is there a way to configure IS to silently remove the previous version?
  • If not, can I write some custom VB-action to silently uninstall the previous version?

EDIT

Not sure this is relevant, but here is what is wrong with the previous uninstaller:

The Installation sequence includes some custom actions. Two of these call executables which in turn install some device drivers. Obviously, they should only run when an installation is underway. Unfortunately, the previous designer did not set the 'NOT REMOVE' condition, which causes the actions to run during an uninstall operation. Thus the uninstaller fails (as it cannot find the driver executables).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is more of a comment than an answer, but it became too long for a comment.

Generally the real fix is to create a minor upgrade (or a minor upgrade patch) to "hotfix" the error in the uninstall sequence and then uninstall the product the normal way (will work regardless if it is a major upgrade uninstall or a manually triggered uninstall). This is possible because a minor upgrade doesn't uninstall the existing product (the failing uninstall custom actions will never run), but just updates the product "in place" (or overwrites it). This allows you to fix whatever was wrong in the uninstall sequence before it is called.

I have successfully used this approach many times to fix critical errors in corporate packages that may have a lot of installed instances and the uninstall sequence is failing miserably. However, it is not exactly a trivial thing to do - it will take time and testing effort. I generally deliver the update as a patch as well, but a minor upgrade should suffice (patching is complicated).

The easiest approach for your minor upgrade package is probably to set a condition that will always be false on all failing uninstall custom actions so that they never run once uninstall is actually triggered. This will obviously leave "some junk" on the box, but you may be able to ignore that or better yet clean it up. Be careful with cleanup code though - it tends to include new bugs that you then have to deal with in due course. Deployment is a process where each added release cycle, bug fix and tweak opens up new possibilities for unexpected errors that then add new complexity and unpredictability for the next release. Keep things as simple as possible. Simply put: just more stuff that can break without adding any benefit. Definitely clean things up if there are operational problems if you don't.

I won't get into too much detail with regards to how a minor upgrade should be implemented. The Installshield help file is quite good on this topic and should help you get things done. I would make an update that does nothing other than change the conditions on the uninstall actions.

Once you have a minor upgrade, you need to apply it using the appropriate command line OR just use Installshield's setup.exe to do this for you. Again see the Installshield help file ("Run-Time Behavior for Minor Upgrades" - this help page should be all you need).

The command line to apply a minor upgrade without a setup.exe wrapper is generally:

msiexec.exe /i product.msi REINSTALLMODE=vomus REINSTALL=ALL

Adding the v option for REINSTALLMODE is very important if you install manually via msiexec.exe without a setup.exe wrapper. This caches the new MSI on the system, and is crucial for minor upgrades to work correctly - in particular for your purpose of fixing the uninstall sequence.

The MSDN documentation for Applying Minor Upgrades.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...