Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pattern to do a wix upgrade without messing with the desktop icons of the users

The Wix setup I'm working on asks the user whether to install a shorcut from the main program on the desktop.

The problem is that during upgrades, the shortcut is removed and then recreated :

  • If the user moved the icon, it's likely recreated somewhere else (next free space starting from top left corner)
  • If the user chose to not create the icon during the initial install, upgrades with UI do not remember that the checkbox to create the icon should be "unchecked" by default, and silent upgrades just create the icon although the user explicitly chose to not have this icon created.

Is there a simple way to properly handle this situation ?

Below are informations on my wix setup :

Install is per machine

The users chooses to install the desktop shortcut via a checkbox that is added on a modified version of the "Choose destination" :

<Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="160" Width="290" Height="17" Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="[INSTALLDESKTOPSHORTCUT]" Text="!(loc.InstallDirDlgCreateDesktopShortcut)" />

In the UI tag I have the property initialized :

<Property Id="INSTALLDESKTOPSHORTCUT" Value="1"/>

This is the component to create the shortcut with the INSTALLDESKTOPSHORTCUT condition :

<Directory Id="DesktopFolder" Name="Desktop">
    <Component Id="desktopconnecteurdts" Guid="a-real-guid-here">
        <Condition>INSTALLDESKTOPSHORTCUT=1</Condition>
        <Shortcut Id="desktopconnecteurdts" Name="DTS eXplorer" WorkingDirectory="ApplicationFolder" Icon="DTSeXplorer.exe" Target="[ApplicationFolder]\DTSeXplorer.exe" Advertise="no" />
    </Component>
</Directory>

Upon launch the setup will check if an older version exists and remove the older version if found :

<Upgrade Id="$(var.UpgradeCode)">
    <UpgradeVersion OnlyDetect="no"
                    Property="PREVIOUSVERSIONSINSTALLED"
                    Minimum="$(var.OldProductVersion)"
                    IncludeMinimum="yes"
                    Maximum="$(var.ProductVersion)"
                    IncludeMaximum="no" 
                    RemoveFeatures="all" />
    <UpgradeVersion OnlyDetect="yes" Property="PROJECT_DOWNGRADE"
                    Minimum="$(var.ProductVersion)" IncludeMinimum="no" />
</Upgrade>

The product version major does not change, for example I'm upgrading from 1.6.8.12345 to 1.7.2.56789

Thanks !

like image 797
Sébastien Nussbaumer Avatar asked Nov 14 '22 07:11

Sébastien Nussbaumer


1 Answers

Write the value of INSTALLDESKTOPSHORTCUT to the registry during installation. Whenever your installer starts, you can read the registry and if that key exists, set it as the default value of that property.

Not sure if you can do anything about the location of the shortcut on the desktop however.

like image 50
BryanJ Avatar answered Dec 06 '22 11:12

BryanJ