InstallShield Tips and Techniques

March 17, 2011

Preselecting Features within an InstallShield Basic MSI Project

Filed under: Reference Materials — shieldmaster @ 9:44 pm

My previous blog discussed a method using InstallScript to determine whether a Feature had been selected by the customer in the Custom Setup dialog .

This blog posting will be about preselecting Features, the methodology and the issues involved.

 

In my sample Custom Setup Dialog, I have three major Features as shown in this Custom Setup Dialog:

 

I have some scripting to do, checking various components installed on the workstation. Now suppose that if:

  • .NET Framework 2.0 is not installed, deselect Feature “.NET Applications” before the dialog Custom Setup is presented
  • .NET Framework 2.0 was found installed, have the Feature “.NET Applications” preselected before the dialog Custom Setup is presented

 

I abbreviated the script logic to the critical script that sets a MSI Property “DOTNET_FEATURE” to a value of “FALSE” to test the logic:

 

NOTE: This script function MUST be sequenced before the standard action “CostFinalize”!

Now we need to set a Condition on the Feature “.NET Applications” that will make the feature be preselected or deselected.

Navigate to the Feature panel and create a Feature condition:

 

This Condition will alter the InstallLevel to be 200 if the MSI Property “DOTNET_FEATURE”=”FALSE”.

The InstallLevel, by default is set to 100, so any Feature or component that has a value from 1 to 100 will install. If you reset the level for a Feature (or sub-feature) to any number >100, the feature will be displayed Unselected.

Here are the results:

 

WARNING: if you set the InstallLevel to a value of 0, then the entry for Client Server will disappear from viewing in the Custom Setup Dialog.

If might be a nice option, but then the customer can never select the feature!

Hope this helps!

SHIELDMASTER

 

 

Advertisements

4 Comments »

  1. Hi,

    I have to repair or Uninstall a particular feature
    I came to know that FeatureRemoveAll/FeatureReinstall /FeatureUpdate acts on all the features already installed on the machine.

    Is there way to selectively uninstall/Repair a particular feature?
    If not please suggest any work around that can be used to achieve the same.

    I see some function like ReinstallFeature where in which we can specify the feature name? How to use this?

    Thanks,
    Maddy

    Comment by alliknew — June 14, 2011 @ 8:06 am

    • Maddy,

      Sorry for not following up on this question. I just noticed it…

      There must be an “approved” method, but I haven’t had much use to play with it. It is possible to pull the MSI Property “AddLocal” and interrogate its values – which will be the features selected, but I would be hesitant to muck around with that, it may mess us future upgrades.

      Charles

      Comment by shieldmaster — October 20, 2011 @ 10:19 pm

  2. I only get the checkbox for feature selection. How can I get the selection box shown in the sample you posted here?

    Thanks.

    Comment by Qing — October 20, 2011 @ 1:19 pm

    • I am using Basic MSI Project – which presents the feature selection box as shown. Quite possibly you are using the InstallScript MSI project type?
      Charles

      Comment by shieldmaster — October 20, 2011 @ 10:16 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: