cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
webwolve
Level 4

Brand new Basic MSI user with question

Hello,

I am about 3 days into the process of building my very first Basic MSI InstallShield 2009 project. As I am finding out, it’s a much different world than InstallScript. I have run into a situation that was easily solvable in InstallScript, but I’m struggling to find the “right” solution in Basic MSI. So, here goes.

I have a need to only allow the end user to run the installation if the folder they choose contains 2 particular files that they would have had installed from another application. If the files exist in the folder, then all is good and the install may continue. If they are missing, I’d like to prompt the user that they must select a different folder because the files were missing.

So, after the user has selected a destination path using the DestinationFolder dialog, I added a custom action filled with my “old” InstallScript code to test for the existence of those files when the user clicks the Next button. Based on these tests, I used MsiSetProperty to set a property that contains whether the files exist or don’t exist.

That’s pretty much where I stand right now. I was thinking that I should proceed by adding a condition to the NewDialog event to only go to the next good dialog if the files exist (that is, if the property has a certain value). Also then, I would add a new SpawnDialog event control based upon the failure value of the property. That dialog would act as a message box to be dismissed by the user, then would return back to the Destination dialog for another attempt.

First, does this make sense to anyone, or is there a much better way to handle this?

Second, I understand that none of this would be touched during a silent install since the UI sequence is skipped, right? I do want to prevent silent installs from running if these files fail to exist also. My approach here is to again call the custom action during the Execute sequence to populate the property. Then, would it be best to call a second custom action to just abort the install if the files did not exist based upon the property value?

Thanks in advance to everyone. I appreciate any and all suggestions as I realize I know very little at this time about MSI.

WebWolve
Labels (1)
0 Kudos
(3) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Depending on your exact searches, it may be better to implement this as a a pair of system searches which search for a file in either SourceDir or SETUPEXEDIR (depending on how you build), and each setting a property such as FILE1FOUND and FILE2FOUND. You can then create a launch condition (or alternately a custom action of type "error") based on a condition like FILE1FOUND AND FILE2FOUND (or negated to NOT(FILE1FOUND AND FILE2FOUND)).

The advantage of this approach is it doesn't use custom code (a bonus in the MSI world), and it will work without dialogs, and regardless of silencing. If the system search can't handle this, you can still run during a silent install by scheduling a custom action the Install Execute sequence.

However, like anything in an MSI (your previous approach included), it is subject to MSI's open nature and being edited or transformed away. So if this is an important business need but not an actual run-time dependency, you may want to enforce it at run-time as well.
0 Kudos
webwolve
Level 4

Thanks for your response MichaelU. I may be misunderstanding something, but to use a system search and the subsequent results as a launch condition, wouldn't I need to know exactly what folder the user has chosen to run this install into before launching the install?

In our case, we have always been EXTREMELY customizeable for the end user. We have never enforced specific folders to where users choose to install. In fact, we allow users to install the same or multiple versions of our apps in as many unique folders as they choose. Thus, my file existence checks above are done when the user clicks the Next button on the DestinationFolder dialog.

Is there any way to do as you suggest under our conditions?

Thanks,
WebWolve
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Ah, I'd misread. Somehow I read it as the folder containing the install must contain these other files. Since you need to allow them to select a folder, that gets a lot murkier.

You'll probably need to split into three parts, somewhat like you do already. One step is selecting the folder, which should be stored in a (public) property. The next step is searching that folder for the files and storing the result into a property. The third is canceling the install on failure.

This will allow the folder to be specified on the command line for a silent install, and you can add the verification and canceling to the InstallExecuteSequence; the dialog sequence can contain the nicer failure message.
0 Kudos