Advanced Installer 踩坑记录

转载自:https://www.xingkongbeta.com/?p=115

这几天用Advanced Installer给公司的软件制作安装包,本来以为只是一项很简单的工作,却不幸地踩到了好几个坑,在此记录下来备忘。

两个Code

UpgradeCode

同一软件的UpgradeCode必须一样,否则无法通过安装包升级安装。墙裂建议在别的地方把UpgradeCode保存一份,否则一旦手贱把UpgradeCode给覆盖了,那请参考本文后节。

ProductCode

同一软件的不同版本,ProductCode必须不一样,否则在安装时会提示“已安装此产品的另一个版本balabala”

允许降级安装

Product Information -> Upgrades,选中Allow side by side installs of different product versions

安装前卸载旧版本

Product Information -> Upgrades,选中Uninstall old version first and then install new version
参考:https://www.advancedinstaller.com/user-guide/upgrades.html

版本号

MSI只认版本号前三位!!!!
如果你的旧版版本号是1.0.0.1,新版是1.0.0.2,那么你在安装新版的时候,即使安装目录与旧版选择的是一致的,安装程序不会卸载旧版本,于是你会在控制面板里发现两个软件,而且新版的不一定会覆盖掉旧版的文件(大概吧,没详细测)

执行PowerShell脚本

Custom Behavior -> Custom Actions,在 Add Custom Action 选项卡中,找到 Run PowerShell inline script,添加然后调整执行顺序
例子:

# Block for declaring the script parameters.

Param()

# Your code goes here.

Get-Process -Name TR.VideoSurveillance 
 Stop-Process
Get-Process -Name WuhanSanZhan 
 Stop-Process
原文地址:https://www.cnblogs.com/zuofaqi/p/15438722.html