The <HarvestProject/>
element is very useful to harvest output from other projects in Visual Studio. However, sometimes significant amounts of content exists outside of Visual Studio. In that case, it is easier to organize the content in a directory tree that matches the desired install locations and instruct Advanced harvesting to gather the content.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:fg="http://www.firegiant.com/schemas/v3/wxs/fgwep.xsd">
<Fragment>
<ComponentGroup Id="ContentComponents">
<Component Directory="ContentFolder">
<fg:HarvestFolder Source="path\to\content\**" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
The Source
attribute uses a syntax similar to MSBuild to include files. The **
syntax includes files in the current directory and all sub-directories. It is also possible to include files that match a pattern. For example, the following includes all .txt files in the content folder.
<Component Directory="ContentFolder">
<fg:HarvestFolder Source="path\to\content\*.txt" />
</Component>
And the following example includes all .txt files below the content folder.
<Component Directory="ContentFolder">
<fg:HarvestFolder Source="path\to\content\**\*.txt" />
</Component>
Careful use of the Source
attribute with the Exclude element can harvest any directory tree.
It is important to note that HarvestFolder does not have the concept of a "key file" so the KeyIdentifier attribute found on the <HarvestProject/>
element is not available. The HarvestFile element can be used instead.