The "Component" Command |
This command has two distinct purposes, it creates or updates a component or makes a component the default for other commands.
The command can be nested and a block must be terminated with "/Component". Any other MAKEMSI commands that have a "component" parameter will use the "current" component details by default.
The macro takes these parameters:
The default for this parameter can be set via the DEFAULT_COMPONENT_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 component 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 "FeatureComponents" table is updated to apply this association and by default all features must already exist, update the "COMPONENT_FeatureComponents_ROW_@VALIDATE" macro to alter this.
At least one or both of "CU" & "LM" should be "N". A value of "Y" will create the component's registry keypath in the "HKCU" hive. A value of "?" means use "HKLM" if the install is per-machine and "HKCU" if its per-user.
At least one or both of "CU" & "LM" should be "N". A value of "Y" will create the component's registry keypath in the "HKLM" hive. A value of "?" means use "HKLM" if the install is per-machine and "HKCU" if its per-user.
The default for this parameter can be set via the DEFAULT_COMPONENT_ATTRIBUTES macro. The initial value for this is "LocalOnly".
Available attributes (can be combined, use space as a separator):
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...
Options |
Please see the "options for commands" section of the manual.
;---------------------------------------------------------------------------- ;--- Component OPTIONS ------------------------------------------------------ ;---------------------------------------------------------------------------- #define? DEFAULT_COMPONENT_OPTIONS_AUTO_CREATION ;;example: CU="Y" (if per-user installation) #define? DEFAULT_COMPONENT_OPTIONS_USER_CREATION ;;Not currently used #define? DEFAULT_COMPONENT_OPTIONS_USER_UPDATE_EXISTING ;;Not currently used #define? DEFAULT_COMPONENT_CREATE Y ;;Default is to create component if attributes exist. #define? DEFAULT_COMPONENT_ATTRIBUTES LocalOnly #define? COMPONENT_REFERENCED_COMPONENTS_MUST_EXIST Y #define? COMPONENT_FeatureComponents_ROW_@VALIDATE NEW -MISSINGDATA ;;See the "@Validate" parameter of the "ROW" command
EXAMPLE 1 |
;--- 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>
EXAMPLE 2 - In Multiple Features |
;----------------------------------------------------------------------------------------------------- ;--- SAMPLE METHOD #1: Create Component (not nested "within" a feature) , add to multiple features --- ;----------------------------------------------------------------------------------------------------- <$Component "This.Component.Is.In.Mult.Features" FEATURE="Files_TryMe,Files_TryMeWithNoRootFeature.MM" Create="Y" Directory_="INSTALLDIR" LM="Y"> ;--- Whatever here ------------------------------------------------------ <$/Component> ;---------------------------------------------------------------------------- ;--- SAMPLE METHOD #2: Map existing component to one or more features ------- ;---------------------------------------------------------------------------- <$Feature "YetAnotherFeature1" Title=^SAMPLE METHOD #2 - Feature 1^> ;--- Add existing component to "enclosing" feature ---------------------- <$Component "This.Component.Is.In.Mult.Features" CREATE="N"><$/Component> <$/Feature> <$Feature "YetAnotherFeature2" Title=^SAMPLE METHOD #2 - Feature 2^> <$/Feature> <$Feature "YetAnotherFeature3" Title=^SAMPLE METHOD #2 - Feature 3^> ;--- Add existing component to current plus a named feature ------------- <$Component "This.Component.Is.In.Mult.Features" FEATURE=".,YetAnotherFeature2" CREATE="N"><$/Component> <$/Feature> ;---------------------------------------------------------------------------- ;--- SAMPLE METHOD #3: Table/Row to update assignment directly -------------- ;---------------------------------------------------------------------------- <$Table "FeatureComponents"> <$Row Feature_=^<$COMPANY_HTMLRPT_FEATURE>^ Component_=^This.Component.Is.In.Mult.Features^> <$/Table>