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 dd命令中dsync与fdatasync的区别【转】

    在Linux系统中经常会使用dd命令来测试硬盘的写入速度,命令会涉及到两个参数:dsync与fdatasync,本文介绍一下其区别. dd if=/dev/zero of=/tmp/1Gbytes b ...

  2. php递归函数细节

    <?php /** *php递归函数细节 *从1到5的阶乘 * */ header("Content-Type:text/html;charset=utf-8"); func ...

  3. 浅谈js设计模式之代理模式

    代理模式是一种非常有意义的模式,在生活中可以找到很多代理模式的场景.比如,明星都有经纪人作为代理.如果想请明星来办一场商业演出,只能联系他的经纪人.经纪人会把商业演出的细节和报酬都谈好之后,再把合同交 ...

  4. PHP isset()、empty()、is_null()的使用区别详解

    PHP的isset()函数 一般用来检测变量是否设置 格式:bool isset ( mixed var [, mixed var [, ...]] ) 功能:检测变量是否设置 返回值: 若变量不存在 ...

  5. 无root或sudo权限,安装mysql

    这其实才是真正的linux,恰当使用权限. 网上找到的中文博客,基本上就那么几篇原创,都要编译源码.但89服务器性能太差编译一次大约半小时无法忍受,在本机上创建了standard用户去尝试几篇博客所言 ...

  6. .NET Core 项目经验总结:项目结构介绍 (一)

    原文地址(个人博客):http://www.gitblogs.com/Blogs/Details?id=384b4249-15e4-41bf-9cf7-44a3e1e51885 作为一个.NET We ...

  7. Java第三阶段学习(六、多线程)

    一.进程和线程的区别: 进程:指正在运行的程序,当一个程序进入内存运行,就变成一个进程. 线程:线程是进程的一个执行单元. 总结:一个程序运行后至少会有一个进程,一个进程可以有多个线程. 多线程:多线 ...

  8. securecrt注册方法

    使用文中的方法,可以注册Version 7.1.0 (x64 build 244)版本的securecrt. 另有注册机下载地址:http://pan.baidu.com/share/link?sha ...

  9. 程序设计实习MOOC / 程序设计与算法(三)第二周测验

    6. 学生信息处理程序 总时间限制: 1000ms 内存限制: 1024kB 描述 实现一个学生信息处理程序,计算一个学生的四年平均成绩. 要求实现一个代表学生的类,并且类中所有成员变量都是[私有的] ...

  10. 《C陷阱与缺陷》阅读笔记(个人版)

    笔记: 第一章:词法陷阱 提倡显示比较if((x = y) != 0) foo(); 第二章:语法陷阱 已知一个类型的声明 该类型的类型转换:吧声明中的变量名和声明末尾的分号去掉,再将剩余的部分用括号 ...