WiX: How to allow autogenerated ComponentGroup to

2020-03-28 21:31发布

I used heat.exe to generate a .wxs file that lists all the files that I want to install. I told heat to put them in a ComponentGroup so I could reference them from another (hand-generated) .wxs file.

However, the autogenerated file specifications look like this:

<Component Id="cmp10D34854E51FC71E0A65900015642460" Directory="dir82EF0D8D89A5B984406E0CCDF2A5E5BC" Guid="*">
    <File Id="fil65369E1F7C8702A7B78CF393C06A9C7B" KeyPath="yes" Source="SourceDir\CHANGELOG.md" />
</Component>

Since the source starts with "SourceDir", I get the following errors in light.exe:

: error LGHT0231 : The component 'cmp10D34854E51FC71E0A65900015642460' has a key file with path 'TARGETDIR\vwf-windows-build\CHANGELOG.md'.  Since this path is not rooted in one of the standard directories (like ProgramFilesFolder), this component does not fit the criteria for having an automatically generated guid.  (This error may also occur if a path contains a likely standard directory such as nesting a directory with name "Common Files" under ProgramFilesFolder.)

Any idea what I need to do to get this working?

1条回答
祖国的老花朵
2楼-- · 2020-03-28 22:04

Funny, that I didn't find your question when I asked a similar one today (Using heat.exe for files placed in WindowsVolume - GUID Issues).

Where's the folder located you specified in the Component's Directory attribute? Automatically generated GUIDs (heat's -ag switch) aren't random for a Component but depend on the target folder. The error message basically tells you to either put the Component into a directory that's rooted in a standard directory (such as [ProgramFilesFolder]) or provide a static GUID. You can achieve the latter one by setting the switch -gg instead of -ag during harvesting:

heat dir HeatDir -out harvested.wxs -var var.SourceDir -cg MyComponentGroup -dr MyInstallDir -g1 -ag -ke -srd -scom -sreg

But be aware that the generated GUIDs are now random. If you use heat for updating the installer project in an automated fashion this may result in problems during upgrade installations.

Hope that helps.

查看更多
登录 后发表回答