Automatic account creation is now enabled. Captcha authentication required for account creation and editing unless you are trusted here.
Modular WiX Development
From WiX Wiki at MindCapers
Fragments
Fragments provide a mechanism for composing a Wix project from multiple WXS files. Immediate children of the root element of a fragment file are, unsurprisingly, Fragment nodes. Immediate children of these are typically a DirectoryRef and a ComponentGroup.
Note the DirectoryRef near the start of the first sample. This makes it behave like the fragment is a child of the INSTALLDIR defined in the main WXS file.
Note that this sample follows the current recommendation of a separate component node for each file. To ameliorate the proliferation of components it uses a ComponentGroup. This is not obligatory. It is equally possible for the Component nodes to be immediate children of the first fragment. This would require a corresponding list of ComponentRef nodes in the Feature shown in sample two. A more traditional, if currently passé version involves a single Component node containing multiple files.
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALLDIR">
<Directory Id="SCRIPTS" Name="SCRIPTS">
<Component Id="Create.Database.sql" Guid="{B4AA135D-8904-4ffa-A1E6-41AC9B36A324}">
<File Id="Create.Database.sql" Name="Create.Database.sql" KeyPath="yes" Source="SCRIPTS\Create.Database.sql"/>
</Component>
<Component Id="Create.DatabaseTables.SQL" Guid="{7CFC15D8-7CB2-449F-9EE6-8CB8D94C89AC}">
<File Id="Create.DatabaseTables.SQL" Name="Create.DatabaseTables.SQL"
KeyPath="yes" Source="C:\CVS\ATOMNet\InstallationCD\SCRIPTS\Create.DatabaseTables.SQL"/>
</Component>
<Component Id="Create.DefaultData.sql" Guid="{91234166-AE21-4768-A53B-CDE3413013AF}">
<File Id="Create.DefaultData.sql" Name="Create.DefaultData.sql" KeyPath="yes"
Source="C:\CVS\ATOMNet\InstallationCD\SCRIPTS\Create.DefaultData.sql"/>
</Component>
<Component Id="Create.DefaultUsersAndGroups.sql" Guid="{21A2B8C5-74FB-4452-B560-2ACC99D0EEC1}">
<File Id="Create.DefaultUsersAndGroups.sql" Name="Create.DefaultUsersAndGroups.sql" KeyPath="yes"
Source="C:\CVS\ATOMNet\InstallationCD\SCRIPTS\Create.DefaultUsersAndGroups.sql"/>
</Component>
<Component Id="Modify.DatabaseTables.1.0.0.1.sql" Guid="{A6E37FAD-FC31-4EB3-B7D4-99C62A32B4AA}">
<File Id="Modify.DatabaseTables.1.0.0.1.sql" Name="Modify.DatabaseTables.1.0.0.1.sql" KeyPath="yes"
Source="C:\CVS\ATOMNet\InstallationCD\SCRIPTS\Modify.DatabaseTables.1.0.0.1.sql"/>
</Component>
<Component Id="Modify.DatabaseTables.1.0.0.2.sql" Guid="{5942966D-AEA4-4AC2-B047-ADD373661E5B}">
<File Id="Modify.DatabaseTables.1.0.0.2.sql" Name="Modify.DatabaseTables.1.0.0.2.sql" KeyPath="yes"
Source="C:\CVS\ATOMNet\InstallationCD\SCRIPTS\Modify.DatabaseTables.1.0.0.2.sql"/>
</Component>
</Directory>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="DatabaseScripts">
<ComponentRef Id="Create.Database.sql"/>
<ComponentRef Id="Create.DatabaseTables.SQL"/>
<ComponentRef Id="Create.DefaultData.sql"/>
<ComponentRef Id="Create.DefaultUsersAndGroups.sql"/>
<ComponentRef Id="Modify.DatabaseTables.1.0.0.1.sql"/>
<ComponentRef Id="Modify.DatabaseTables.1.0.0.2.sql"/>
</ComponentGroup>
</Fragment>
</Wix>
In the main WXS file, a feature refers to this component group:
<Feature Id="Server" Title="Server and database" Description="our product name" Display="expand" ConfigurableDirectory="INSTALLDIR" Absent="disallow" AllowAdvertise="no" TypicalDefault="install" Level="1"> <ComponentRef Id="ServerElements" /> <ComponentGroupRef Id="DatabaseScripts" /> </Feature>
The files make no explicit reference to one another. They are simply both listed in the wixproj file. Linking is based on the DirectoryRef and ComponentGroupRef Id values matching Directory and ComponentGroup Id values.

