WiX安装程序嵌套的开始菜单目录,LGHT0204错误



我使用CPACK和类似的东西为我的WiX3安装程序创建一个嵌套的开始菜单文件夹,如My Company/My Product:

<Product>
... etc ...
<DirectoryRef Id="ProgramMenuFolder">
<Directory Id="ProgramMenuVendorFolder" Name="My Company">
<Directory Id="ProgramMenuProductFolder" Name="My Product"/>
</Directory>
</DirectoryRef>
<!-- shortcuts to applications in the start menu -->
<DirectoryRef Id="ProgramMenuProductFolder">
<Component Id="ProgramMenuShortcutsComponent" Guid="$(var.CPACK_WIX_PRODUCT_GUID)">
<CreateFolder Directory="ProgramMenuVendorFolder" />
<CreateFolder Directory="ProgramMenuProductFolder" />
<RemoveFolder Id="RemoveProgramMenuVendorFolder" Directory="ProgramMenuVendorFolder" On="uninstall" />
<RemoveFolder Id="RemoveProgramMenuProductFolder" Directory="ProgramMenuProductFolder" On="uninstall" />
<Shortcut Id="MainShortcut" Name="My Product" Target="path/to/the/executable.exe" Directory="ProgramMenuProductFolder" />

<!-- RegistryValue whichs serves as KeyPath -->
<RegistryValue
Root="HKCU"
Key="Software$(var.CPACK_PACKAGE_VENDOR)$(var.CPACK_PACKAGE_NAME)"
Name="InstalledStartMenuShortcuts"
Type="integer"
Value="1" />
</Component>
</DirectoryRef>
... etc ...
</Product>

不幸的是它失败了:

main.wxs(32) : error LGHT0204 : ICE21: Component: 'ProgramMenuShortcutsComponent' does not belong to any Feature.

这是什么意思,我应该添加/删除什么?

您需要在您想要控制组件安装的特性下添加一个ComponentRef