I am trying to learn Wix 4.0 to create an installer for an application I am developing. Once my application is built I have a bunch of files one folder that I would like to install to program files, I have read that the harvesting functionality allows me to streamline this process and create component mappings for the entire directory, but I am not sure what this example is showing. I am curious about what the <ItemGroup>
tag is, and I think I have a fundamental misunderstanding of how to point this to my directory in order to use the components.
<Project Sdk="WixToolset.Sdk">
<ItemGroup>
<HarvestDirectory Include="FilesDir">
<ComponentGroupName>HarvestedComponents</ComponentGroupName>
<DirectoryRefId>ApplicationFolder</DirectoryRefId>
<SuppressRootDirectory>true</SuppressRootDirectory>
</HarvestDirectory>
<BindPath Include="FilesDir" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Heat" />
</ItemGroup>
</Project>
Thanks, and I will edit with more information where needed.
So basically the <ItemGroup>
just groups together different elements in the WiX project file.
For harvesting whole directories the following elements are important:
<HarvestDirectory Include="Folder/To/Harvest">
: specify the path of the folder you want to harvest<ComponentGroupName>ApplicationFilesComponent</ComponentGroupName>
: specify a name for the component that will be generated by heat (you then need to include this component in your installation process)<DirectoryRefId>ApplicationDirectory</DirectoryRefId>
: specify the Id of directory, where the files should be written to (More information: https://wixtoolset.org/docs/schema/wxs/directory/)<BindPath Include="Folder/To/Harvest" />
: again, specify the path of the folder you want to harvest hereTips for error prevention (that I have learned the hard way):
<PackageReference Include="WixToolset.Heat" Version="4.0.0" />
Note: I'm not quite sure why its necessary to specify the path to be harvested two times (the documentation lacks that point). If someone has more details please comment or edit this answer.