Reputation: 19
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).
Upvotes: 0
Views: 848
Reputation: 710
I believe that the WiX GUID generation algorithm requires that the component install location be rooted in one of the standard system paths. I think this is because they use the component installation paths as part of the seed for a version 3 UUID. This means the UUID generated will be the same every build unless the component installation path changes.
Using the TARGETDIR, or in your example INSTALLFOLDER, as the component directory means it is not rooted in a Windows Special Folder location like ProgramFiles so the GUID gen algorithm can not generate a repeatable GUID.
Current Windows installation guidelines are pretty specific about the paths for installing binaries,documents, and application data. Ever since XP that has been %PROGRAMFILES%, %PUBLIC%\Documents and %APPDATA%.
I think the issue is rooted in your desire to install into a user selected path ignoring the windows installer guidelines.
Upvotes: 0