Search code examples
installationwixcpack

WiX installer nested start-menu directory, LGHT0204 error


I'm using CPACK and something like this for my WiX3 installer to create a nested start menu folder like 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>

Unfortunately it fails:

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

What does this mean, and what should I add/remove ?


Solution

  • You need to add a ComponentRef under the Feature you want to control the install of your Component.