WiX:如何允许自动生成的ComponentGroup自动生成Guids

时间:2014-07-10 00:03:36

标签: wix windows-installer auto-generate wix3.8

我使用heat.exe生成一个.wxs文件,列出了我要安装的所有文件。我告诉heat把它们放在ComponentGroup中,这样我就可以从另一个(手工生成的).wxs文件中引用它们。

但是,自动生成的文件规范如下所示:

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

由于源代码以“SourceDir”开头,因此我在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.)

知道我需要做些什么来实现这个目标吗?

1 个答案:

答案 0 :(得分:4)

好笑,我今天问了一个类似的问题时没有找到你的问题(Using heat.exe for files placed in WindowsVolume - GUID Issues)。

您在Component的Directory属性中指定的文件夹位于何处?自动生成的GUID(heat的-ag开关)对于Component来说不是随机的,而是依赖于目标文件夹。错误消息基本上告诉您要么将Component放入一个以标准目录为根的目录(例如[ProgramFilesFolder]),要么提供静态GUID。您可以通过在收获期间设置开关-gg而不是-ag来实现后者:

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

但请注意,生成的GUID现在是随机的。如果使用heat以自动方式更新安装程序项目,则可能会在升级安装期间导致问题。

希望有所帮助。