首页 > 代码库 > WiX: uninstall older version of the application
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.
WiX: uninstall older version of the application
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。