SatbirSingh
SatbirSingh

Reputation: 198

WiX missing 'Start In' property in desktop shortcut

I am working with WiX from last 5 month with no issues. Recently, i am in need to have "StartIn" property in App Desktop shortcut. By default, its empty.

Here is my full Installer code.

I am working with below code:

<Component Id="myapplication.EXE" DiskId="1" Guid="*">
   <File Id="myapplication.EXE" Name="My Application.exe" 
         Source="D:\My Application\My Application.exe">
      <Shortcut Id="desktopShortcut" Directory="DesktopFolder" 
                Name="My Application" WorkingDirectory="INSTALLDIR"
                Icon="DesktopIcon.exe" IconIndex="0" 
                Description="My Application Description" />
      <Shortcut Id="ExeShortcut" Directory="ProgramMenuDir" 
                Name="My Application" Icon="StartMenuIcon.exe" IconIndex="0" />
    </File>
</Component>

But didn't work.

I have also tried adding "Target" property:

<Shortcut Target= "INSTALLDIR" Id="desktopShortcut" Directory="DesktopFolder" 
          Name="Virtual Sim Center Beta" WorkingDirectory="INSTALLDIR"
          Icon="DesktopIcon.exe" IconIndex="0" 
          Description="My Application Description"  />

but getting error message:

The Shortcut/@Target attribute cannot be specified when the Shortcut 
element is nested underneath a File element.

Upvotes: 1

Views: 1674

Answers (4)

Shyam Poovaiah
Shyam Poovaiah

Reputation: 334

In addition to the answer by @Adiono check whether the 'WorkingDirectory' folder actually contains the 'Target'. The 'Start in' of my shortcut was blank even when both 'WorkingDirectory' and 'Target' had valid values, but the 'Target' was not present in the 'WorkingDirectory'.

Upvotes: 1

Adiono
Adiono

Reputation: 1044

This script bellow is working for my WIX:

    ....
    <!-- Desktop Menu -->
    <DirectoryRef Id="DesktopFolder">
      <Component Id="FooDesktopShortcutMenu" Guid="*">
        <Shortcut Id="FooApplicationDesktopShortcut"
                  Name="Foo Application"
                  Description="The Foo is Cool!"
                  Target="[#FooMainApp]"
                  WorkingDirectory="INSTALLFOLDER"
                  Directory="DesktopFolder"/>
        <RemoveFolder Id="DesktopFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\Microsoft\FooApplication" 
                       Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </DirectoryRef>

    ....

    <!-- Tell Wix -->
    <Feature Id="ProductFeature" Title="FooSetup" Level="1">
      .....
      <ComponentRef Id="FooDesktopShortcutMenu"/>
      .....
    </Feature>
    .....

Upvotes: 4

PhilDW
PhilDW

Reputation: 20780

Glytzhkof is right and so is your WiX source - just put it under the Component.

Upvotes: 2

Stein &#197;smul
Stein &#197;smul

Reputation: 42136

I don't have Wix set up to try this, but you can try to move the Shortcut element up to be nested under the Component element and not the File element. Then set the WorkingFolder attribute. Try something like this.

Upvotes: 0

Related Questions