[wix-users] Strategies for Reducing Installer Code Duplication
egcastr at gmail.com
Fri Sep 18 15:03:09 PDT 2020
On Fri, Sep 18, 2020 at 1:05 PM Todd Hoatson via wix-users <
wix-users at lists.wixtoolset.org> wrote:
> These ambiguities and complexities are making it difficult for me to decide
> on a strategy for eliminating as much duplication as possible in our WiX
Hopefully the other responses to your email will help remove the
WiX has a lot of built-in flexibility for decomposing your installer into
multiple Fragments and multiple source files. That flexibility
unfortunately results in complexity so there is a balancing act.
I'd recommend that you design the Feature and Component decomposition of
the installer first. Make a simple tree of Features installed by your
installer and what Components those Features install. Remember that
Components may be installed by multiple Features.
Then you can group related Components that are always installed together
into logical ComponentGroups so they can be referenced together with a
single ComponentGroupRef and reference those ComponentGroups from Features.
If you have related Features that should be referenced from other Features,
then use a FeatureGroup to represent that logical grouping. Then you can
reference the single FeatureGroup with a FeatureGroupRef from the parent
I'd recommend that all Components in a single ComponentGroup are defined
together in a single Fragment. If you need to group ComponentGroups
together into larger ComponentGroups, then define the larger ComponentGroup
in its own Fragment. Use a similar organization for your Features and
FeatureGroups. Your root Features must be defined or referenced in Product.
>From there you can decide which Fragments you want separate source files
and which Fragments can cohabitate in the same source file but this perhaps
You will find that some resources must be defined in the same Fragment as
the Component that references the resource. In other cases, there are
implicit references that bring in Fragments as necessary. Implicit
references are both a blessing and a curse. The good thing is the linker is
really good about telling you when it cannot find something which means
you're missing an explicit reference so I wouldn't worry about this too
much. Just be aware so that you know what you're looking for when you see
those types of link errors.
This part of installer design and implementation is tricky. Let us know how
it goes. We're here to help!
Edwin G. Castro
More information about the wix-users