MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Column Macros[Next]: Component?
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->Component

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:

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>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Column Macros[Next]: Component?


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.