zoukankan      html  css  js  c++  java
  • WiX: 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.

    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.

  • 相关阅读:
    快速创建MockAPI
    Eolinker SaaS 7.5 版本更新
    【翻译】几个优质的REST API工具
    建立RESTful API测试程序的基础
    Ubuntu下gcc安装及使用
    c++转化成delphi的代码
    VCL组件的属性和方法详解
    Delphi组件开发教程指南目录
    FASM 第一章 简介
    (一)SQL 基础知识
  • 原文地址:https://www.cnblogs.com/zjoch/p/6273224.html
Copyright © 2011-2022 走看看