Designing Features for Objects

InstallShield 2018

It is very important that you design your features well. A haphazard design of features may make it difficult for you to internationalize your object, selectively build files into the object, or conditionally install files. The following sections discuss a few guidelines that will help you accurately and efficiently design the feature layout of your object.

Selectively Installing an Object’s Features

More often than not, you will want to place conditions on the selection of your object’s features. For example, if you are creating an object that installs DCOM, you will want to check if the target system already has DCOM installed. If DCOM is present, reinstalling it would be a waste of time and may cause complications. To allow your object’s features to be conditionally selected without unwanted effects on the project that includes the object, you must design your object according to the following guidelines.

Your object should never select its own features but only deselect them as needed. (An object’s features are selected by default.) If your object selects one or more of its own features, that will cause the feature that includes the object to be selected—even if that feature had previously been deselected by the end user or the project’s internal logic.

However, an object’s deselecting its own features can also potentially cause a problem. The following paragraphs describe the problem and its solution.

Suppose a project has two main features, A and B; B has no subfeatures but contains an object that, in turn, contains a feature, C. The InstallScript engine automatically deselects a feature when all its child features are deselected; so if feature C is not selected, the DCOM object will not be selected. If the DCOM object is not selected, feature B will not be selected. This behavior can cause problems if you have components associated with the main feature, in this case feature B. Because the feature that contains the components is not selected, the components directly associated with it will not be installed.

If you want your component to be selected regardless of whether DCOM is selected, create a “dummy” feature within your object. If feature C is not selected, the dummy feature will still be selected. Since the dummy feature is selected, feature B will also be selected, and its component will be installed.

Installing Language Dependent Files

When developing an installation that targets multiple languages, you often have different language versions of the same file. If these files have a common name, you may encounter problems when InstallShield builds your installation and copies all of the installation files to the release. When the Release Wizard runs, it takes all of the files within a feature and stores them in the same directory on the release. If you have two files with the same name, but in separate components, one of those files will be overwritten if the two components belong to the same feature. To overcome this problem, you will need to create a separate feature for each language that you are targeting. For more information, see Preparing an Object for Internationalization.