[wix-users] Purpose of Fragments

Tyler Gustafson tgustafson at solacom.com
Mon Aug 29 07:00:21 PDT 2016


I'm pretty new to the whole WiX thing and I was wondering if someone could explain the purpose of fragments to me.
>From what I can gather they are good for grouping your installer design into multiple files and I've also read a few discussions that indicate you might need to use them to allow a patch to contain only files which have changed as opposed to everything.


I like the idea of being able to use a GUI editor for WiX when I want to do a quick overview of everything and found this one which seems alright http://wixedit.sourceforge.net/ but it doesn't seem to handle fragments well and currently our installer is structured similar to the following:

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="WINDOWSVOLUME" >
        <Directory Id="INSTALLDIR" Name="company">
          <Directory Id="PRODUCTDIR" Name="product">
            <Directory Id="PLUGINSDIR" Name="plugins">
          </Directory>
        </Directory>
      </Directory>
    </Directory>
    <SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]"/>
</Fragment>

<Fragment>
    <ComponentGroup Id="PluginsComponents" Directory="PLUGINSDIR">
      <Component Id="foo.dll" Guid="SOME-GUID">
        <File Id="foo.dll" Name="foo.dll" Source="path/foo.dll" KeyPath="yes"></File>
      </Component>
      <Component Id="bar.dll" Guid=" SOME-OTHER-GUID ">
        <File Id="bar.dll" Name="bar.dll" Source="anotherpath/bar.dll" KeyPath="yes"></File>
      </Component>
    </ComponentGroup>
</Fragment>

If I restructure the installer to be more like the following, my tool works but I'm not sure what the consequences might be. I am particularly interested in being able to make small patches but other pros, cons and tips about fragments are very much appreciated.

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="WINDOWSVOLUME" >
        <Directory Id="INSTALLDIR" Name="company">
          <Directory Id="PRODUCTDIR" Name="product">
            <Directory Id="PLUGINSDIR" Name="plugins">
      <Component Id="foo.dll" Guid="SOME-GUID">
        <File Id="foo.dll" Name="foo.dll" Source="path/foo.dll" KeyPath="yes"></File>
      </Component>
      <Component Id="bar.dll" Guid=" SOME-OTHER-GUID ">
        <File Id="bar.dll" Name="bar.dll" Source="anotherpath/bar.dll" KeyPath="yes"></File>
      </Component>
            </Directory>
          </Directory>
        </Directory>
      </Directory>
    </Directory>

Thanks,
Tyler


More information about the wix-users mailing list