Wix Toolset v4 Shortcut & installation directory per login user

501 Views Asked by At

Using WiX Toolset v4 & Heatwave plugin from Visual Studio, I just try to add shortcut to current user Desktop but have a hard time doing it. My install directory is Id="ProgramFilesFolder".

  • my goal is have shortcut at C:\Users\{User}\Desktop\ and installation at C:\Program Files (x86) Anyone know how to do it?
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
  <Package Name="Package"
           Manufacturer="Company"
           Version="1.0.0.0"
           Scope="perMachine"
           UpgradeCode="{PUT-GUID-HERE}">
    <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />

    <Feature Id="Main">
      <ComponentGroupRef Id="ExampleComponents" />
      <ComponentGroupRef Id="ShortcutGroup" />
    </Feature>

    <!--Add User Interface dialog-->
    <ui:WixUI
            Id="WixUI_InstallDir"
            InstallDirectory="InstallProductFolder" />
    <!--InstallDirectory="DesktopFolder"/>-->
  </Package>
</Wix>

I did try to set Scope tag to different values

  • When I set the Scope to perUserOrMachine
    • I got the Desktop shortcut in correct place like C:\Users{User}\Desktop\ While the installation directory would messed up and go like C:\Users{User}\AppData\Local\Programs\
  • When I set the Scope to perMachine
    • I got Desktop shortcut put into public Desktop like C:\Users\Public\Desktop while the installation is correct at C:\Program Files (x86)
1

There are 1 best solutions below

0
sergol On

The third possible value for Scope is perUser,
just change Scope="perUser" in order to get disared location of your shortcut C:\Users\{User}\Desktop
For more details take a look official documentation: PackageScopeType