I have this working but I don't like my solution.

I have a perMachine install in which I ALWAY need to create 1 shortcut.
Optionally, I need to create a 2nd shortcut on the desktop (all users).  My
component definitions look something like this...Is there a better way to
do this?

<Component Id="MyExeComp" Guid="{XXX}">
    <Condition><![CDATA[NOT MAKEEXTRASHORTCUT]]></Condition>
    <File Id="MyExeFile" KeyPath="yes" Source="..." >
      <Shortcut
        Id="MyAlwaysShortcut"
        Name="MyApp"
        Directory="STARTMENULOCATION"
        Advertise="yes"/>
    </File>
</Component>

<Component Id="MyExeComp2" Guid="{NOT-XXX}">
    <Condition><![CDATA[MAKEEXTRASHORTCUT]]></Condition>
    <File Id="MyExeFile2" KeyPath="yes" Source="...">
      <Shortcut
        Id="MyAlwaysShortcut2"
        Name="MyApp"
        Directory="STARTMENULOCATION"
        Advertise="yes"/>
      <Shortcut
        Id="MyOptionalShortcut"
        Name="MyApp"
        Directory="DesktopFolder"
        Icon="icon.ico"
        Advertise="yes"/>
    </File>
</Component>

I tried adding a new optional component (registry) in lieu of the
MyExeComp2 but then I kept getting ICE violations...(see below)

<Component Id="DesktopShortcutReg" Guid="AAA">
    <Condition><![CDATA[MAKEEXTRASHORTCUT]]></Condition>
    <RegistryKey Root="HKLM" Key="Software\MyCompany\MyApp" >
      <RegistryValue Name="DesktopShortcut" Type="integer" Value="1"
KeyPath="yes"/>
    </RegistryKey>
    <Shortcut Id="DesktopShortcut"
        Target="[#MyExeFile]"
        Name="MyApp"
        Directory="DesktopFolder"/>
</Component>

ICE43: Component DesktopShortcutReg has non-advertised shortcuts. It's
KeyPath registry key should fall under HKCU.
ICE57: Component 'DesktopShortcutReg' has both per-user and per-machine
data with a per-machine KeyPath.
ICE69: Mismatched component reference. Entry 'DesktopShortcut' of the
Shortcut table belongs to component 'DesktopShortcutReg'. However, the
formatted string in column 'Target' references file 'MyExeFile' which
belongs to component 'MyExeComp'. Components are in the same feature.

If I make the DesktopShortcut an advertized shortcut I can't use the Target
attribute, so how do I specify the exe the shortcut will run?
-- 
Tony
------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to