1

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.
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
SatbirSingh
  • 198
  • 1
  • 11

4 Answers4

4

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>
    .....
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Adiono
  • 1,034
  • 11
  • 19
  • Sorry, Adiono. This didn't worked for me. I have edited my post & added my full code there. – SatbirSingh Apr 30 '14 at 06:20
  • I have posted my full wix script on this answer: http://stackoverflow.com/a/23334824/1586914. Maybe you can get some clue there? – Adiono Apr 30 '14 at 06:24
2

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

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Gabriel Mongeon Apr 28 '14 at 10:47
  • 1
    It answers the question by pointing out that the shortcut tag is in the incorrect place and should be underneath the Component tag and not the File tag. I am not requesting clarification from anyone. – PhilDW Apr 28 '14 at 17:34
1

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'.

Shyam Poovaiah
  • 334
  • 1
  • 2
  • 9
0

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.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • I don't think there is any **WorkingFolder** attribute with Wix. Its **WorkingDirectory**, which i have already added in my code. But still no luck. – SatbirSingh Apr 28 '14 at 06:15