Components and Features

[This is preliminary documentation and subject to change.]

A Microsoft® Windows® installer application consists of features and components. A feature is a building-block of an application from the user's perspective. A component is a building-block of an application from the programmer's perspective. You can use this system of separating applications into components and features to make installation and system management transparent to the user.

A feature is a specific capability of an application as seen from the user's perspective. For example, a feature could be a spell-checker, thesaurus or a group of clip-art. Users want to know what they can do with a program; they are not concerned about the constraints under which you build the application. In other words, users do not care how you actually separate the program into pieces. You can structure features into a hierarchy so that when a child feature is installed, the parent feature is installed as well.

A component, in contrast, is how you break down an application. Examples of components are a group of related files, a COM object, or a library.

When a user selects clip-art files from a feature list, the associated component is installed. The component could be a viewer and a indexer for the clip-art.

Deciding how to separate an application into components involves a trade-off between performance and resiliency. Each component has a KeyPath associated with it. This KeyPath can be a file, registry key, or blank which indicates a directory. When a component is used, the installer checks the existence of the KeyPath. If the KeyPath is in its proper location, the installer assumes that the entire component is installed correctly. Thus if you use many small components, the installer checks the validity of the installation thoroughly, but checking many files can slow your application.

The relationship between features and components also defines the pieces in which an application is installed. From the user's perspective applications are installed one feature at a time; however, the installer resolves these features into components to actually carry out the installation. In other words, applications are installed component-by-component from the operating system's perspective, and installed feature-by-feature from a user's perspective.

While a many-to-many relationship between features and components is possible, the mechanism is most efficient when the relationship is as one-to-one as possible. It is possible for a component to map to more than one feature, but all parts of the component should do this together. Components are associated with a single folder. All files that are part of a component must reside in the same folder. Also, all parts of a component, whether they are registry entries or files are installed together. Thus, if your proposed component has portions with different setup logic, you must break the component into smaller pieces.

A feature can use the facilities of one or more components just as a component can be used by more than one feature. In addition, features can have their own hierarchical structure. This makes it easier to install groups of related features together.

For more information on using features, see the Feature Request Model and Requesting a Feature. For more information on separating an application into features and components, see Separating an Application into Features and Separating an Application into Components.