WIX降级预防警告在错误的时间显示

时间:2011-12-19 14:08:12

标签: user-interface wix upgrade sequence custom-action

我对WIX安装程序有一个奇怪的问题。它具有自定义操作,阻止应用程序在较新版本存在时安装:

<Upgrade Id='SOME_GUID'>
  <UpgradeVersion OnlyDetect='yes' Property='SELFFOUND'
    Minimum='$(var.Version)' IncludeMinimum='yes'
    Maximum='$(var.Version)' IncludeMaximum='yes' />
  <UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
    Minimum='$(var.Version)' IncludeMinimum='no' />
</Upgrade>

<InstallExecuteSequence>
  <Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
  <Custom Action='NoDowngrade' After='FindRelatedProducts'>NEWERFOUND</Custom>
<InstallExecuteSequence>

<CustomAction Id='AlreadyUpdated' Error='$(var.ProductName) has already been updated to $(var.Version) or newer.' />
<CustomAction Id='NoDowngrade' Error='A later version of $(var.ProductName) is already installed.' />

没什么特别的 - 就像在WIX教程中一样。我使用Mondo UI,几乎没有自定义对话框。

<UIRef Id="WixUI_Mondo" />

问题在完成所有配置步骤后,单击“安装”按钮后执行自定义操作“NoDowngrade”。我希望在启动安装程序后立即看到该消息。 我使用Orca util检查了安装程序表中的installExecuteSEquence - “AlreadyUpdated”CA具有Sequence = 27. FindRelatedProducts事件具有Sequence = 25。我的其他动作“NoDowngrade”使用了27,与“AlreadyUpdated”几乎相同。 应该在Sequence = 49上显示第一个UI对话框。我想 - PrepareDlg在InstallUISequence中具有此值。 看起来除了我的自定义操作之外,FindRelatedProducts和PrepareDlg之间什么都不会发生。

但令人惊讶的是,安装日志反过来说:

MSI (c) (90:88) [13:08:03:768]: Running UISequence
MSI (c) (90:88) [13:08:03:768]: PROPERTY CHANGE: Adding EXECUTEACTION property. Its value is 'INSTALL'.
MSI (c) (90:88) [13:08:03:768]: **Doing action: FindRelatedProducts**
Action 13:08:03: FindRelatedProducts. Searching for related applications
Action start 13:08:03: FindRelatedProducts.
FindRelatedProducts: Found application: {E25981A8-83D3-4183-B53C-F6E70FC9D1E0}
MSI (c) (90:88) [13:08:03:769]: PROPERTY CHANGE: Adding SELFFOUND property. Its value is '{E25981A8-83D3-4183-B53C-F6E70FC9D1E0}'.
Action ended 13:08:03: FindRelatedProducts. Return value 1.
MSI (c) (90:88) [13:08:03:770]: Doing action: PrepareDlg
--------------------
MSI (s) (2C:84) [13:08:10:658]: Running ExecuteSequence
MSI (s) (2C:84) [13:08:10:658]: **Doing action: FindRelatedProducts**
Action 13:08:10: FindRelatedProducts. Searching for related applications
Action start 13:08:10: FindRelatedProducts.
MSI (s) (2C:84) [13:08:10:660]: Skipping FindRelatedProducts action: already done on client side
Action ended 13:08:10: FindRelatedProducts. Return value 0.
MSI (s) (2C:84) [13:08:10:660]: Doing action: AppSearch
Action 13:08:10: AppSearch. Searching for installed applications
Action start 13:08:10: AppSearch.
MSI (s) (2C:84) [13:08:10:662]: Skipping AppSearch action: already done on client side
Action ended 13:08:10: AppSearch. Return value 0.
MSI (s) (2C:84) [13:08:10:662]: **Doing action: AlreadyUpdated**
Action 13:08:10: AlreadyUpdated. 
Action start 13:08:10: AlreadyUpdated.
APS DTE Axiom Server has already been updated to 12.1.1.1582 or newer.
MSI (s) (2C:84) [13:08:12:420]: Product: APS DTE Axiom Server -- APS DTE Axiom Server has already been updated to 12.1.1.1582 or newer.

Action ended 13:08:12: AlreadyUpdated. Return value 3.

因此我们可以看到FindRelatedProducts尝试执行两次,但AlreadyUpdated CA仅在第二次尝试时执行。 教程没有说明如何在InstallUISEquence中放置此CA.它是否需要,或者如果不存在它可能不是一个好方法?或者你能为这个问题推荐更好的解决方案吗?

2 个答案:

答案 0 :(得分:3)

也为InstallUISequence重复InstallExecuteSequence部分。您希望在对话期间进行检查,因此它们是InstallUISequence的一部分。您还希望它们在InstallExecuteSequence期间发生,以防用户进行安静的安装,跳过UI。

<InstallUISequence>
  <Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
  <Custom Action='NoDowngrade'    After='FindRelatedProducts'>NEWERFOUND</Custom>
<InstallExecuteSequence>

<InstallExecuteSequence>
  <Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
  <Custom Action='NoDowngrade'    After='FindRelatedProducts'>NEWERFOUND</Custom>
<InstallExecuteSequence>

答案 1 :(得分:1)

改为使用MajorUpgrade