[wix-users] Strategies for Reducing Installer Code Duplication

Edwin Castro egcastr at gmail.com
Fri Sep 18 13:41:24 PDT 2020


On Fri, Sep 18, 2020 at 1:05 PM Todd Hoatson via wix-users <
wix-users at lists.wixtoolset.org> wrote:

>     <Feature Id="Always" Title="Required"
>              Description="These files are required in order for the Demo
> program to run."
>              Level="1"   Absent="disallow" >
>         <ComponentGroupRef Id="DEMOPROG" />
>         <ComponentRef Id="DesktopShortcut" />
>         <ComponentRef Id="AppMenuShortcuts" />
>     </Feature>
>
> If there are component groups defined in a given fragment, in addition to
> DEMOPROG, will they be implicitly brought into the "Required" feature?  Or
> are they simply made available for reference in some part of the WiX code?
>

Any Components not in the DEMOPROG ComponentGroup and other ComponentGroups
in the same Fragment containing the DEMOPROG ComponentGroup will be
available to be referenced. If those components are not referenced in a
Feature, then they cannot be selected to be installed. You should always
ensure all your Components are directly or indirectly (through a
ComponentGroup) referenced from one or more Features.

I prefer to use a single ComponentGroup per Fragment so that I can
reference all Components in the Fragment with a single ComponentGroupRef.
This implies that all Components in said feature are always installed
together regardless of which Features they referenced from.

You can compose ComponentGroups into larger ComponentGroups if necessary
using ComponentGroupRef. And you can also compose FeatureGroups out of
Features, Components and ComponentGroups using FeatureRef, ComponentRef and
ComponentGroupRefs.

--
Edwin G. Castro



More information about the wix-users mailing list