How to include fragments in Wix?

Steph Ragazzi picture Steph Ragazzi · Nov 2, 2011 · Viewed 13k times · Source

I have created a wixlib to share fragments in some wix projects.
I can reference fragments which have Property in my main wix file with a PropertyRef, but how can I reference fragments where I want a bulk copy of its content??
For example I have a fragment which tests if .net framework is installed and I want to include that fragment in my main wix file in the project tag...
Here's the fragment located in my wixlib that I want to include in several wix project:

  <Fragment Id="fm35">
    <PropertyRef Id="NETFRAMEWORK35" />
    <Condition Message="framework 3.5 is not installed">
      <![CDATA[Installed OR NETFRAMEWORK35]]>
    </Condition>
  </Fragment>

Thanks!!

Answer

Alex picture Alex · Apr 8, 2014

Back in the old days of wix 2 we used to have FragmentRef elements. It was very easy to include any fragment in your Product section and it was very easy for anyone reading the xml to figure out what was being done.

<FragmentRef Id="CustomActionFrag" />
<FragmentRef Id="PropertiesFrag" />

Now in wix 3 they have eliminated the FragmentRef element. Not sure why. I find it very anoying, because in my Product element I have to add several references to "something defined in my fragments"

<CustomActionRef Id="caDoSomething"/>
<PropertyRef Id="PropCryptic"/>

If I don't do that the fragment is completely ignored and does not make its way into the final MSI.

That's very cryptic for anyone reading the xml. Give my FragmentRef's back!