WiX: How to allow autogenerated ComponentGroup to autogenerate Guids

大城市里の小女人 提交于 2019-12-01 08:58:41

问题


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:


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.



来源:https://stackoverflow.com/questions/24665555/wix-how-to-allow-autogenerated-componentgroup-to-autogenerate-guids

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!