Reputation: 46034
We use InstallShield 2010 to install our software using the InstallScript approach. There are some prerequisites that may be installed as necessary. In the OnBegin
callback, we execute some logic to validate the system before continuing with the installation. If the user cancels the installer at this point, the installation will exit, but the prerequisites are not uninstalled. I have a few questions.
1) Is it possible to perform our custom validation before the prerequisites are ever installed? This doesn't appear possible within InstallShield 2010 based on everything I've read, but I'd like to have that confirmed.
2) Is there a way to force the prerequisites to be uninstalled if the user cancels the installation?
3) Are there alternatives that would allow the prerequisites to be installed after the OnBegin
callback? I read something about prerequisites being tied to a particular feature, but it is unclear how to do this in the UI.
Upvotes: 0
Views: 1723
Reputation: 15905
Suite and Suite/Advanced UI projects available in newer versions of InstallShield handle this more directly, but how about putting OnBegin
before OnBegin
by wrapping one InstallScript installation in another?
Regarding your other sub-questions...
Prerequisites are handled in a fire and forget manner, and are designed to install things that may have already been present (and skip the installation in that case), so there's no direct support for uninstalling them.
Feature prerequisites are available in Basic MSI projects. For InstallScript projects, you are encouraged to use script code including LaunchApplication
or similar approaches, however this can end up requiring reimplementing a prerequisite-style architecture if you don't just launch another InstallScript installation.
Upvotes: 0
Reputation: 1427
1) The answer to your first question is also probably the easiest most plausible solution. You should be able to get your custom validation to run before the other prerequisites by creating your own prq file with all the custom validation logic wrapped up into it. To create your own .prq file you can just copy an existing prq in the SetupPrerequisites folder and rename it. Then open the Redistributable view in InstallShield. The copied/renamed .prq file should now show up in the list, and you can right click and select Edit Prerequisite
. Then change the Properties
,Conditions
,Files To Include
,Application To Run
, etc.
For example, suppose your validation is an executable that runs and sets a registry key depending on success. You could check if the registry key exists as a condition of whether to run the prerequisite, include the exe and any dependencies in the Files to Include
tab, run that executable in the Application to Run
tab, and in the Behavior tab set the drop down of what happens if the launch conditions are still not met to Abort the setup
After you're satisfied with all your prerequisite settings, right click again and select Set prerequisite order...
and make sure that your custom validation prerequisite is at the top of the list.
2) Yes, there is probably a way to run some custom actions that will ensure all your prerequisites get uninstalled on a rollback, but that seems complicated and I personally wouldn't recommend it. What if the user already had the prerequisite installed on their machine and then they aborted your install and it uninstalled software they already had on their machine? They may not be too happy about that.
3) Not totally sure about this, but I don't think it's possible to have the OnBegin
function execute before the prerequisites run. I say that because normally the prerequisites are launched outside of the MSI execution by a Setup.exe or something similar, at least from my understanding. Then the MSI is launched after the prerequisites complete. If the OnBegin runs as part of the MSI execution (which I believe it does) then it can't be launched before the prerequisites are launched.
Upvotes: 1