![]() |
|
![]() |
The "Feature" Command |
This command has two distinct purposes, it creates or updates a Windows Installer feature or makes a feature the default for other commands.
The command can be nested and a block must be terminated with "/Feature". Any other MAKEMSI commands that have a "feature" parameter will use the "current" component details by default.
Splitting your MSI into multiple features is a mechanism for giving users choice at install time as features can be optionally installed. For example the MAKEMSI install has many optional features as you see if you selected the "custom" button.
Another reason for creating multiple features is that each feature can be installed into its own separate directory tree with the user being able to control the location of both these trees.
The macro takes these parameters:
This value is not normally seen by a user, I recommend that the feature name be as meaningful as possible as this may be the only recognisable value in an event log (Windows Installer logging is "hopeless"). This is the reason the optional default feature contains the version number and as much of the product name that will fit. This probably applies mostly to features that you Advertise.
The default for this parameter can be set via the DEFAULT_FEATURE_CREATE macro. This is initially "Y", however it has no effect unless at least one named parameter is specified (including this one).
If you are updating a feature then one or more Table column names and values can be supplied. There are no defaults for update, only create!
Whether creating or updating you should read the appropriate documentation in "MSI.CHM".
The default for this parameter can be set via the DEFAULT_FEATURE_DISPLAY macro. The initial value for this is 2.
A value of 0 makes this feature hidden (invisible) to the user.
The default for this parameter can be set via the DEFAULT_FEATURE_LEVEL macro. The initial value for this is 3.
If this parameter contains ";" then it actually contains a condition and true and false levels in the order:
When updating an existing feature the "false" value can be "?" to leave it alone. An example of a valid value is "3;0;DISABLE=1".
The "Directory" and "DirectoryTree" commands is another way that this value can be set.
The default for this parameter can be set via the DEFAULT_FEATURE_ATTRIBUTES macro. The initial value for this is "FavorLocal".
Attributes adjust the available options that a user might see as well as other defaults:
Available attributes (can be combined, use space as a separator):
I have used "FavorSource FavorAdvertise" on a component so that its files are not installed until a user requires them (clicks on an advertised shortcut).
Note that most MAKEMSI commands validate the names of all parameters supplied. As this command doesn't you need to be particularly careful to get them right...
EXAMPLES |
;--- Create Feature (a number of items defaulting) -------------------------- <$Feature "F_Dennis" Title=^Dennis' "Feature"^ Attributes="3+4+5"> ;--- Create Component (assign to feature) -------------------------------- <$Component "C_Dennis" Directory_="WindowsFolder"> ;--- Do stuff -------------------------------------------------------- ;... <$/Component> ;--- Create SUB-Feature -------------------------------------------------- <$Feature "F_Under_Dennis" CREATE="Y"> ;;CREATE="Y" REQUIRED here as no attributes supplied <$Component "C_Under_Dennis" ComponentId="" Directory_="WindowsFolder"> ;--- Do stuff ---------------------------------------------------- ;... <$/Component> <$/Feature> <$/Feature> ;--- Update feature --------------------------------------------------------- <$Feature "F_Dennis" Level="99" CREATE="N"><$/Feature> ;--- Reference existing feature --------------------------------------------- <$Feature "Fred"> 'Just a reference (becomes default feature) <$/Feature>
![]() ![]() |
| ![]() ![]() |