轉載自: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