I am trying to harvest files from the folder structure bellow using Wix Toolset 4, with the WixToolset.Heat nuget package, in Visual Studio 2022 in order for my files to go into C:\Testing.
<Fragment>
<StandardDirectory Id="TARGETDIR">
<Directory Id="INSTALLFOLDER" Name="Testning"/>
</StandardDirectory>
<Fragment>
But this does cause an error, WIX0211, stating that the path i.e. TARGETDIR\Testing\MyFile.txt is not rooted in one of the standard dirs. and that the generated component does not meet the criteria for auto.gen. GuIds.
If I try and disable auto.gen. Guids I get an error saying that the components need a Guid. If I use the following, changing the StandardDir Id, it compiles, but that does not install to C:\Testing\ obviously.
<Fragment>
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="INSTALLFOLDER" Name="Testning"/>
</StandardDirectory>
<Fragment>
I have tried looking for a solution but everything so far points to Wix 3.x and does not work. I tried setting TARGETDIR property but I can not solve this.
The fragment is located in a seperate file, Folders.wxs and bellow is the config of heat in the wixproj file.
<ItemGroup>
<HarvestDirectory Include="C:\Test\Test Installer\Test" Outputs="$(ProjectDir)Files.wxs">
<ComponentGroupName>HarvestedComponents</ComponentGroupName>
<DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
<SuppressRootDirectory>true</SuppressRootDirectory>
<PreprocessorVariable>TargetSourceDir</PreprocessorVariable>
</HarvestDirectory>
</ItemGroup>
Uppdate:
I tried using heat.exe that comes with Wix Toolset 3 to be able to get a wxs file containing the harvested files as that was blocked by the error but I still can not get the installer to put the files in c:\Testing folder
Uppdate 2:
Apparently I made a mistake running the installer from a bad short cut. The workaround using the harvester from Wix Toolset 3 worked. If using this solution there is a need to change the namespace of the generated file(s).