2
votes

I have the following situation.

My product installs the binaries inside c:\Program Files (x86)\MyCompany\MyApp\ and a shortcut under C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MyCompany.

I build the msi using this great example: https://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/

I just added the following piece of code

  <!-- ApplicationShortcut-->
  <Directory Id="ProgramMenuFolder">

    <Directory Id="ApplicationProgramsFolder" Name="!(loc.ManufacturerName)">

      <Component Id="ApplicationShortcut" Guid="F4B7EAFA-FF19-41B4-8267-3AEFC12235A7">
        <Shortcut Id="ApplicationStartMenuShortcut"
             Name="!(loc.ApplicationName)"
             Description="!(loc.ProductDescription)"
             Target="[INSTALLDIR]MyApp.exe"
             WorkingDirectory="INSTALLDIR"
    />
        <RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\!(loc.ManufacturerName)\!(loc.ApplicationName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>

    </Directory>

  </Directory>

The problem is the following

  • I install the application the fist time, it will install the shortcut just fine
  • Now I start the app and choose Pin to taskbar, this will create a shortcut inC:\Users\\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar`
  • If I rebuild the msi and execute the setup again, the taskbar shortcut is not clickable anymore, because the shortcut in C:\Users\<user>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar is missing

Is it possible to maintain the taskbar shortcut during an update?

1
Would this happen if the MSI that is installed is a minor upgrade instead of a major upgrade? What about advertised versus non-advertised shortcuts? I have never tried, maybe you know off the top of your head.Stein Åsmul

1 Answers

1
votes

I found the answer here: https://stackoverflow.com/a/33402698/98491

<InstallExecuteSequence>
  <RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
</InstallExecuteSequence>

This prevents shortcuts from being uninstalled during an update.

As described in the comments, the disadvantage is that, after uninstall, the TaskBarShortCut remains, but that is something that a user might expect. Having to recreate a pinned taskbar shortcut everytime he updates a software is not.