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 :
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 !
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With