我有两个MSI,它们的ProductIds和Versions除外。我正在测试MajorUpgrade路径to make sure it's seamless for end users。
具有更高版本的MSI会关闭Windows服务,并删除所有工件,但是在安装带有1603错误的“新”二进制文件时失败。 实际上,看起来它正在执行卸载,包括文件和注册表清理,但后来无法执行安装。
如果我再次运行更高版本的MSI,安装工作正常:创建文件和目录,启动Windows服务,以及安装完成后我设置运行的可执行文件。
我生成了一个详细的日志(下面的代码段),但修复看似问题的问题(文件没有复制到正确的位置)并不明显。
Wix代码:
<Product Id="*"
Name="product name"
Language="1033"
Version="1.2.0"
Manufacturer="Company Name"
UpgradeCode="stable-upgrade-guid">
<!-- snip -->
<Property Id="WixShellExecTarget" Value="[#TheProgram.exe]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
<InstallExecuteSequence>
<Custom Action="CheckForRunningProcesses_CA" After="InstallValidate" />
<Custom Action="LaunchApplication" After="InstallFinalize"/>
</InstallExecuteSequence>
我使用msiexec /i "product.msi" /l*v "upgrade.log"
生成了下面的日志。这似乎是相关的一点:
MSI (s) (70:B0) [14:30:58:905]: Note: 1: 2318 2:
MSI (s) (70:B0) [14:30:58:905]: Note: 1: 1321 2: C:\Config.Msi\ 3: 5
MSI (s) (70:B0) [14:30:58:905]: Note: 1: 2205 2: 3: Error
MSI (s) (70:B0) [14:30:58:905]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 2911
DEBUG: Error 2911: Could not remove the folder C:\Config.Msi\.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2911. The arguments are: C:\Config.Msi\, ,
MSI (s) (70:B0) [14:30:58:908]: Note: 1: 2318 2:
MSI (s) (70:B0) [14:30:58:908]: Calling SRSetRestorePoint API. dwRestorePtType: 0, dwEventType: 103, llSequenceNumber: 14, szDescription: "".
MSI (s) (70:B0) [14:30:58:909]: The call to SRSetRestorePoint API succeeded. Returned status: 0.
MSI (s) (70:B0) [14:30:58:909]: Unlocking Server
MSI (s) (70:B0) [14:30:58:911]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
Action ended 14:30:58: InstallFinalize. Return value 1.
MSI (s) (70:B0) [14:30:58:912]: Doing action: LaunchApplication
MSI (s) (70:B0) [14:30:58:912]: Note: 1: 2205 2: 3: ActionText
Action 14:30:58: LaunchApplication.
Action start 14:30:58: LaunchApplication.
MSI (s) (70:58) [14:30:58:915]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI12D1.tmp, Entrypoint: WixShellExec
WixShellExec: Error 0x80070002: ShellExec failed with return code 2.
WixShellExec: Error 0x80070002: failed to launch target
CustomAction LaunchApplication returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 14:30:58: LaunchApplication. Return value 3.
Action ended 14:30:58: INSTALL. Return value 3.
任何想法为什么MajorUpgrade会删除旧版本,但不会安装新版本,但在后续运行中,它确实如此?
答案 0 :(得分:1)
当然,我在提出问题之后会发现答案。线索是in this StackOverflow question,不知怎的,我还没有看到......
要解决此问题,您需要移动您的 稍后删除ExistingProducts操作。如果您正在使用MajorUpgrade 元素然后
Schedule='afterInstallExecute'
或Schedule='afterInstallFinalize'
应该做到这一点。你需要成为 更加小心组件规则。
将MajorUpdate
的时间表更改为afterInstallExecute
是一个问题:
<MajorUpgrade
DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."
Schedule="afterInstallExecute" />
一点也不明显。