Refactor installer upgrade logic using MajorUpgrade element#3
Merged
Refactor installer upgrade logic using MajorUpgrade element#3
Conversation
修改内容: 1. 使用 MajorUpgrade 替代旧的 Upgrade + RemoveExistingProducts 组合 2. 设置 Schedule="afterInstallExecute" 确保新版本先安装完成再卸载旧版本 3. 添加 AllowSameVersionUpgrades="yes" 支持同版本覆盖安装 4. 添加中文降级错误提示信息 技术细节: - 旧策略使用 RemoveExistingProducts Before="InstallInitialize",会在安装新版本前先卸载旧版本 - 新策略使用 MajorUpgrade Schedule="afterInstallExecute",先安装新版本再卸载旧版本 - 用户数据保存在 HKCU\Software\Sand Soft\Desktop Notes,在升级过程中会被完整保留 - 这是 WiX 推荐的最佳实践,提供更安全可靠的升级体验 https://claude.ai/code/session_01JbJbLZrdhMn7p28mbyxdoX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaced the manual upgrade detection and removal logic with WiX's built-in
MajorUpgradeelement, simplifying the installer configuration and improving upgrade handling.Key Changes
PropertyandUpgradeelements that detected previous installationsMajorUpgradeelement configured to:RemoveExistingProductscustom action fromInstallExecuteSequence(now handled automatically byMajorUpgrade)Implementation Details
The
MajorUpgradeelement is the recommended WiX approach for handling major version upgrades. It automatically manages:The
Schedule="afterInstallExecute"attribute ensures new files are installed before removing the old version, reducing downtime during upgrades. TheAllowSameVersionUpgrades="yes"setting enables repair/reinstall scenarios.