views:

367

answers:

2

I'm working on an installer project that consists of an MSI file and a bootstrap application that manages the prerequisites; and since the need for some of the prerequisites depends on what features the user chooses to install, the bootstrap app also provides the UI. I want to be able to force the Add/Remove Programs (or Programs and Features) control panel (ARP) to run the bootstrap application instead of the MSI when the user wants to run a modify install. I've tried changing the ModifyPath value under the installer's Uninstall Registry key to the path of the bootstrap application, but to no avail. Clicking the Change button in the ARP still gets me the MSI.

Is there an easy way to do what I want? Failing that, is there a way for the MSI to detect that it was run from the ARP using the Change button so that I could get it to show an error message that tells the user to run the bootstrap app instead? (I.e., does the ARP use the same command line arguments that a user would use to run the MSI and specify a modify install without having to see the maintenance page of the UI? If not, what should I look for?)

Edit My installer is installing not just one application, but a suite of applications, each of which the user is allowed to choose not to install. (We're installing these applications as a suite, because most of them depend on one of them in particular being installed. Therefore, it'll be easier on the user to have just one installer handle them all, rather than the separate installers that this new installer is going to replace.)

The applications in the suite don't all require the same set of prerequisites, therefore, it is not easy for the MSI to check for the prerequisites until it knows which applications in the suite the user wants to install. Furthermore, we want to make it easy for the user by having the installers for all of the prerequisites for the applications that the user does want installed launched automatically. (This is the main reason why the installer's UI was implemented in the bootstrap app.)

Is it possible for the MSI to launch the bootstrap app and then silently exit immediately while the bootstrap app carries on, eventually relaunching the MSI? (When the bootstrap app launches the MSI, one of the command line args it passes into the MSI is a property that tells it that the bootstrap app launched it. This is currently used, among other things, to allow the MSI to show an error message telling the user to run the bootstrap app unless an uninstall or repair install was specified on the command line.)

A: 

Add/Remove Programs will only run your MSI, there is no support for finding or running any bootstrapper apps.

What you can (and should) do is add prerequisite checking to your MSI regardless of how it is run. That way you can warn the user that they are asking for something that can not currently be accomplished (adding a feature that doesn't have its prerequisites yet).

You could add a message about running the bootstrapper instead if a prereq is missing.

Rob McCready
A: 

I was able to solve my dilemma by getting the MSI to launch the bootstrap app for me. I simply wrote a custom action that launches the bootstrap app and does not wait for it to finish. Initially, I tried to put the custom action into the UI sequence, but I couldn't end the install without generating errors that way.

Since my goal was to run the bootstrap only for Modify installs, I put a couple of new control events on the Next button of the Maintenance dialogue (where the user chooses between Modify, Repair and Remove). If the user has chosen Maintenance (MaintenanceMode ~= "Modify"), the custom action is launched, and the dialogue is dismissed using the EndDialog action with Exit as the argument. (I modified the condition on the existing control event that goes to the next dialogue to be the negative of the one that causes the bootstrap to be launched, i.e., NOT (MaintenanceMode ~= "Modify").) The bootstrap app is programmed to skip past the Maintenance dialogue in its GUI and start off at the next dialogue in the sequence, although the user is permitted to go back to the Maintenance dialogue if he so chooses. (If he does, the bootstrap app simply goes back to its version of the Maintenance dialogue, which looks very similar to the one in the MSI.)

I know, it's a bit of a kludge, but it does what I need it to do. :-)

RobH

related questions