From 82763b68366ffac782e82e68e792d873b8bc9a88 Mon Sep 17 00:00:00 2001 From: Tobias Markmann <tm@ayena.de> Date: Fri, 27 Mar 2015 11:55:15 +0100 Subject: Improve Windows MSI installer upgrade experience Previously every time WiX heat.exe ran it generated new GUIDs for all the file components that MSI was going to install. Windows installer deletes components if there is no software/component left that is referencing it. This patch uses the -ag flag instead of the -gg flag for heat.exe so it will generate deterministic GUIDs based on the filename and other things instead of completely random new one on each run. In addition we schedule the upgrade to run after the new version has been installed. This way old files are first replaced with the new ones, shortcuts remain and are not deleted, pinned shortcuts remain usable. Afterwards MSI uninstalls the old version, specifically the components that are not reference anymore. Test-Information: Tested (a) two version upgrade with this patch and (b) an upgrade from a version without this patch to a version with this patch. a) The upgrade works as expected. MSI installs the new version and then uninstalls the old version. The pinned shortcut stays alive and works. b) In this case during the deinstallation files of the new installation are deleted, since there are two components with different GUIDs which however use the same filenames. Running a repair on this installation, or first deinstalling the old version and then the new one manually fixes this. Change-Id: I842a288d837962e77efaa15b17d3877e923c7e49 diff --git a/BuildTools/SCons/Tools/wix.py b/BuildTools/SCons/Tools/wix.py index 7b62508..705d249 100644 --- a/BuildTools/SCons/Tools/wix.py +++ b/BuildTools/SCons/Tools/wix.py @@ -7,7 +7,7 @@ def generate(env) : if len(wixPath) > 0 and wixPath[-1] != "\\": wixPath += "\\" env['WIX_HEAT'] = wixPath + 'heat.exe' - env['WIX_HEAT_OPTIONS'] = '-nologo -gg -sfrag -suid -template fragment -dr ProgramFilesFolder' + env['WIX_HEAT_OPTIONS'] = '-nologo -ag -sfrag -suid -template fragment -dr ProgramFilesFolder' env['WIX_CANDLE'] = wixPath + 'candle.exe' env['WIX_CANDLE_OPTIONS'] = '-nologo' env['WIX_LIGHT'] = wixPath + 'light.exe' diff --git a/Swift/Packaging/WiX/Swift.wxs b/Swift/Packaging/WiX/Swift.wxs index c14f23d..1e8d129 100644 --- a/Swift/Packaging/WiX/Swift.wxs +++ b/Swift/Packaging/WiX/Swift.wxs @@ -10,7 +10,14 @@ <Package Id='*' Keywords='Installer' Description="Swift Installer" Comments="Swift is available under the GPL version 3" Manufacturer="Swift.im" InstallerVersion='300' Languages='1033' Compressed='yes' SummaryCodepage='1252' InstallScope="perMachine"/> <Media Id='1' Cabinet='Swift.cab' EmbedCab='yes'/> - <MajorUpgrade DowngradeErrorMessage="A newer version is already installed. Remove this version if you wish to downgrade." /> + <!-- Schedule the upgrade to afterInstallExecute means that MSI will first install the new version + over the existing version and run the uninstall of the old version afterwards. This way shortcuts + are not recreated on every new installation and pinned shortcuts stay alive. + However this requires that the components for installed files with the same filename will always + have the same GUID (do not run heat.exe with -gg flag) or else when MSI removes the components + of the old version with the same filename as components of the new version it will delete the + files that belong to components of the new version.--> + <MajorUpgrade Schedule="afterInstallExecute" DowngradeErrorMessage="A newer version is already installed. Remove this version if you wish to downgrade." /> <Directory Id='TARGETDIR' Name='SourceDir'> <!-- Disabling CRT merge module, because it's not working -- cgit v0.10.2-6-g49f6