Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninstall older version of the application

I have installer generated by WiX and I want it to ask: "You have already installed this app. Do you want to uninstall it?" when run. Currently it installs the app once more and uninstalls it incorrectly if there was another version installed before.

like image 340
idm Avatar asked Nov 09 '11 12:11

idm


People also ask

How do I install an older version of an app?

To download an app's older version, you will have to search for the app in the site's search bar and tap on the “Versions” button to see a listing of all the previous version APKs. Then, you can just download the version of the app you want and install it.


1 Answers

The folowing will allow you to perform an upgrade, which removes previous versions:

<?define Version = "!(bind.fileVersion.<YOUR-FILE-HERE>)" ?>
<?define UpgradeCode = "<YOUR-GUID-HERE>" ?>

<Upgrade Id="$(var.UpgradeCode)">
  <UpgradeVersion Minimum="$(var.Version)" IncludeMinimum="no" OnlyDetect="yes" Property="NEWERVERSIONDETECTED" />
  <UpgradeVersion Minimum="0.0.0" Maximum="$(var.Version)" IncludeMinimum="yes" IncludeMaximum="yes" Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade>

<InstallExecuteSequence>
  <RemoveExistingProducts After="InstallInitialize" />
  <Custom Action="NewerVersion" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom>
</InstallExecuteSequence>

<CustomAction Id="NewerVersion" Error="A later version of [ProductName] is already installed." />

You will need to define UpgradeCode and Version to suit your needs, this will also allow you to perfom an upgrade even if the version hasn't changed.

like image 146
David Martin Avatar answered Oct 20 '22 08:10

David Martin