簡體   English   中英

如何在WiX中使用After =“InstallValidate”的RemoveExistingProducts之前執行自定義操作

[英]How to execute Custom Action before RemoveExistingProducts with After=“InstallValidate” in WiX

我有這樣的事情:

<InstallExecuteSequence>
  <RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>

由於其中一個卸載失敗,我需要執行自定義操作以在RemoveExistingProducts之前解決問題。 有些東西:

<CustomAction Id="FixStuff" .. />

<InstallExecuteSequence>
  <Custom Action="FixStuff" Before="RemoveExistingProducts" />
  <RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>

這當然不起作用,因為自定義操作不能在InstallInitialize之前。 我真的想刪除InstallValidate和InstallInitialize之間的現有產品,但我想在刪除現有產品之前執行FixStuff。

甚至可以這樣做嗎?

遺憾的是,您無法在使用當前配置的RemoveExistingProducts之前運行提升的自定義操作。

一些可能的方法是:

  1. 在InstallFinalize之前移動RemoveExistingProducts。 這解決了自定義操作問題,但是由於此方法有許多限制(組件需要在版本之間維護其名稱和GUID,您的自定義操作應該知道在安裝結束時執行升級等),因此可能會出現其他問題。

  2. 創建一個EXE引導程序,在啟動新的MSI之前修復舊的安裝程序。 此引導程序可以通過清單要求管理員權限:

http://msdn.microsoft.com/en-us/library/bb756929.aspx

  1. 使用此方法修復損壞的MSI:

    • 修復舊MSI中的問題
    • 創建一個BAT或EXE引導程序,通過此命令重新訪問它:

    msiexec / fv <path_to_msi>

    • 在新軟件包之前將此MSI作為更新分發

當您的新程序包運行RemoveExistingProducts時,舊的緩存MSI應該被修復,它應該正確卸載。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM