In my WiX installer, if I use this code, my desktop shortcut works perfectly fine:
<Component Id="TrayWithStartMenuAndDesktopShortcuts" Directory="INSTALLFOLDER" Permanent="no" SharedDllRefCount="no" Transitive="no">
<Condition><![CDATA[STARTMENUSHORTCUT="1" AND DESKTOPSHORTCUT="1"]]></Condition>
<File Id="TrayFileWithStartMenuAndDesktopShortcuts" DiskId="1" Hidden="no" ReadOnly="no" System="no" Vital="yes" Compressed="yes" Name="Tray.exe" Source="Tray.exe" KeyPath="yes">
<Shortcut Id="TrayWithStartMenuAndDesktopShortcutsDesktopShortcut" Directory="DesktopFolder" Name="Creator" WorkingDirectory="INSTALLFOLDER" Icon="Creator.ico" Advertise="yes" />
<Shortcut Id="TrayWithStartMenuAndDesktopShortcutsProgramFilesShortcut" Directory="ProgramMenuFolder" Name="Creator" WorkingDirectory="INSTALLFOLDER" Icon="Creator.ico" Advertise="yes" />
</File>
</Component>
But when I use the following code, any time I double click my desktop shortcut, an error message pops up saying, "Component not used on this computer.":
<Component Id="TrayWithStartMenuAndDesktopShortcuts" Directory="INSTALLFOLDER" Permanent="no" SharedDllRefCount="no" Transitive="no">
<Condition><![CDATA[STARTMENUSHORTCUT="1" AND DESKTOPSHORTCUT="1"]]></Condition>
<File Id="TrayFileWithStartMenuAndDesktopShortcuts" DiskId="1" Hidden="no" ReadOnly="no" System="no" Vital="yes" Compressed="yes" Name="Tray.exe" Source="Tray.exe" KeyPath="yes">
<Shortcut Id="TrayWithStartMenuAndDesktopShortcutsDesktopShortcut" Directory="DesktopFolder" Name="Creator" WorkingDirectory="INSTALLFOLDER" Icon="Creator.ico" Advertise="yes" />
<Shortcut Id="TrayWithStartMenuAndDesktopShortcutsProgramFilesShortcut" Directory="ProgramMenuFolder" Name="Creator" WorkingDirectory="INSTALLFOLDER" Icon="Creator.ico" Advertise="yes" />
</File>
</Component>
<Component Id="TrayWithStartMenuShortcut" Directory="INSTALLFOLDER" Permanent="no" SharedDllRefCount="no" Transitive="no">
<Condition><![CDATA[STARTMENUSHORTCUT="1" AND DESKTOPSHORTCUT<>"1"]]></Condition>
<File Id="TrayFileWithStartMenuShortcut" DiskId="1" Hidden="no" ReadOnly="no" System="no" Vital="yes" Compressed="yes" Name="Tray.exe" Source="Tray.exe" KeyPath="yes">
<Shortcut Id="TrayFileWithStartMenuShortcutProgramFilesShortcut" Directory="ProgramMenuFolder" Name="Creator" WorkingDirectory="INSTALLFOLDER" Icon="Creator.ico" Advertise="yes" />
</File>
</Component>
Note how the installation changes based on the conditions that are met. What can I do to install my shortcuts conditionally like this and make them work properly?