码迷,mamicode.com
首页 > 移动开发 > 详细

WiX: uninstall older version of the application

时间:2017-01-11 14:19:38      阅读:330      评论:0      收藏:0      [点我收藏+]

标签:ror   maximum   form   not   seq   read   rate   min   and   

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.

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.

WiX: uninstall older version of the application

标签:ror   maximum   form   not   seq   read   rate   min   and   

原文地址:http://www.cnblogs.com/zjoch/p/6273224.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!