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的更多相关文章

  1. 解决方案: the selected file is a solution file but was created by a newer version of this application and cannot be opened

    最近在用IronGithub访问Github api时遇到一个问题: the selected file is a solution file but was created by a newer v ...

  2. how to install an older version of package via NuGet?

    转载 http://stackoverflow.com/questions/10206090/how-to-install-an-older-version-of-package-via-nuget ...

  3. [Windows] 重新安装/卸载桌面版OneDrive / Reinstall/ Uninstall Desktop Version OneDrive

    Deep within the OS is a backup copy of the OneDriver installer. To find it, go to  File Explorer> ...

  4. Mac OS build caffe2 Error:This file was generated by an older version of protoc which is

    问题所在 我们可以发现这个错误跟protobuf的版本有关,因此我们可以执行script/diagnose_protobuf.py 我们可以看到,pip install protobuf 和 brew ...

  5. mysql无法安装,报 The older version of MySQL Installer - Community cannot be removed. Contact your technical support group

    解决办法: C:\Users\Administrator>msiexec /i C:\Users\Administrator\Downloads\mysql-installer-web-comm ...

  6. From MSI to WiX, Part 8 - Major Upgrade, by Alex Shevchuk

    Following content is reprinted from here, please go to the original website for more information. Au ...

  7. Android的包管理机制浅析(二)

    上篇刚好说到获取到了签名信息,以下进入安装过程,直接上源代码: private void installNewPackageLI(PackageParser.Package pkg, int pars ...

  8. Android 1.6 PackageManagerService源码分析

    文件清单 framework\base\services\core\java\com\android\server\pm\PackageManagerService.java PackageManag ...

  9. Android应用程序安装过程浅析

    我们知道在android中.安装应用是由PackageManager来管理的,可是我们发现PackageManager是一个抽象类.他的installPackage方法也没有详细的实现. 那在安装过程 ...

随机推荐

  1. linux笔记_day09

    1.运算器.控制器.存储器.输入输出(IO) 地址总线:内存寻址 数据总线:传输数据 控制总线:控制指令 寄存器:cpu暂时存储器 2.系统设定 默认输出设备:标准输出,STDOUT,1(描述符)(显 ...

  2. malloc 函数详解

    很多学过C的人对malloc都不是很了解,知道使用malloc要加头文件,知道malloc是分配一块连续的内存,知道和free函数是一起用的.但是但是: 一部分人还是将:malloc当作系统所提供的或 ...

  3. 集合类List、Set、Map的区别、联系和遍历方式

    说集合之前,先说说数组和集合: 1.数组长度是固定的,当超过容量后会在内存中重新创建一个原来数组1.5倍长度的新数组,再把元素存进去:数组既可以存储基本数据类型,又可以存储引用数据类型. 2.集合长度 ...

  4. wpf XAML 设计器异常,提示NullReferenceException 未将对象引用设置到对象例

    设计了一个控件,然后在使用该控件的界面上,出现上图,这个应该是设计器的bug,解决办法 不要在界面上直接写Load事件 在cs构造函数里手动注册,并且在控件的构造函数里增加判断 if (Designe ...

  5. vs2010 快捷键

    我自己的快捷键: visual studio 2010快捷键: visual studio 2010快捷键: 强迫智能感知:Ctrl+J撤销:Ctrl+Z强迫显示参数信息:Ctrl+Shift+空格重 ...

  6. .NetCore 下使用多个DbContext

    一个项目中使用多个DbContext 或者种数据库的多个DbContext 业务需要 单个DbContext使用不需要给出说明 1.dotnet ef migrations add migration ...

  7. 字符串匹配的kmp算法 及 python实现

    一:背景 给定一个主串(以 S 代替)和模式串(以 P 代替),要求找出 P 在 S 中出现的位置,此即串的模式匹配问题. Knuth-Morris-Pratt 算法(简称 KMP)是解决这一问题的常 ...

  8. 【LOJ】#2278. 「HAOI2017」字符串

    题解 好神仙的题啊 感觉转二维平面能想到,算重复情况的方法真想不到啊 通过扒stdcall代码获得的题解QAQQQQ 我们先把\(p_i\)正串反串建出一个AC自动机来 然后我们把s串放在上面跑匹配, ...

  9. 002 jquery基本选择器

    1.选择器 2.基本选择器 3.程序(包含以上五种基本选择器) <!DOCTYPE html> <html> <head> <meta charset=&qu ...

  10. jupyter安装,修改登录密码,启动

    jupyter安装,修改登录密码,启动     1.安装jupyter: pip install jupyter     (如果报错) pip install jupyter notebook   2 ...