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.

时间: 2024-10-05 23:17:22

WiX: uninstall older version of the application的相关文章

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 ry the following: Uninstall-Package Newtonsoft.Json -Force followed by: Install-Package Newtonsoft.Json -Version <press tab key for autocomplete> twi

brew uninstall older mysql and install mariadb

https://stackoverflow.com/questions/4359131/brew-install-mysql-on-mac-os/6378429#6378429 原文地址:https://www.cnblogs.com/Sir-Lin/p/9603827.html

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. Author: Alex Shevchuk Introduction A typical Major Upgrade removes a previous version of an application and installs a new version.  This blog will guid

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

上篇刚好说到获取到了签名信息,下面进入安装过程,直接上源码: private void installNewPackageLI(PackageParser.Package pkg, int parseFlags, int scanMode, UserHandle user, String installerPackageName, PackageInstalledInfo res) { // Remember this for later, in case we need to rollback

Android应用程序安装过程浅析

我们知道在android中,安装应用是由PackageManager来管理的,但是我们发现PackageManager是一个抽象类,他的installPackage方法也没有具体的实现.那在安装过程中是怎么执行的呐? 调用方 查看代码可以知道ApplicationPackageManager是直接继承自PackageManager的,所以最终代码会调用ApplicationPackageManager下的installPackage(Uri packageURI, IPackageInstall

WIX Custom Action (immediate, deffered, rollback)

Following content is directly reprinted from From MSI to WiX, Part 19 - The Art of Custom Action, Part 1 Author:Alex Shevchuk Introduction Today we will start exploring custom actions, how to write them, what makes custom action good custom action an

How to Uninstall Internet Explorer 11 for Windows 7

Internet Explorer 11 is the newest version of Microsoft's web browser, but not everyone is a fan. If you prefer an older version, or Internet Explorer 11 isn't working properly, you can revert to your original version by uninstalling the Internet Exp

Android sdk version and API level

确定app的系统API level,在mainfest中设置minSdkVersion和targetSdkVersion:对app进行版本控制,在mainfest中设置versionCode和versionName. Supporting Different Platform Versions Tip: In order to provide the best features and functionality across several Android versions, you shou

android &amp;lt;application&amp;gt; 开发文档翻译

由于本人英文能力实在有限,不足之初敬请谅解 本博客仅仅要没有注明"转",那么均为原创.转贴请注明本博客链接链接 <application>语法:    <application android:allowTaskReparenting=["true" | "false"]                 android:allowBackup=["true" | "false"]