2012-03-08 91 views

回答

13

因此,當上,最終的解決辦法是像這個:

<CustomAction Id="Install" Directory="APPLICATIONROOTDIRECTORY" 
       Execute="deferred" Impersonate="no" Return="ignore" 
       ExeCommand="[APPLICATIONROOTDIRECTORY]MyExeName.exe -install" /> 

<CustomAction Id="Uninstall" Directory="APPLICATIONROOTDIRECTORY" 
       Execute="deferred" Impersonate="no" Return="ignore" 
       ExeCommand="[APPLICATIONROOTDIRECTORY]MyExeName.exe -uninstall" /> 

<InstallExecuteSequence> 

    <Custom Action='Install' After='InstallFiles' > 
    $ProductComponent = 3 
    </Custom> 

    <Custom Action='Uninstall' After='InstallInitialize' > 
    ?ProductComponent = 3 
    </Custom> 

</InstallExecuteSequence> 

有沒有建議可以改進它?

+0

什麼是ProductComponent? – 2017-08-05 05:31:14

17

看一看這個blog在部分如何定製筆者,需要管理員權限

的其他link真正解釋了所有類型的自定義操作的行爲。 在Wix中的CustomAction元素。

這應該會對您有所幫助。

看你的解決方案後,您似乎在做一個類型18 CustomAction,在這裏我粘貼以前的博客的內容,對這些類型:

自定義操作類型18 調用它安裝有一個可執行在當前會議期間應用。 CustomAction表中的Source列包含File表中記錄的關鍵字。

CustomAction表中的目標列包含可執行文件的命令行字符串。 適用所有返回處理,執行調度和腳本內執行選項。

由於文件安裝與應用程序,則對自定義操作類型18順序限制:

If the source file is not already installed on the computer: 
    Custom action must be sequenced after CostFinalize action because only after this action path to the file can be resolved. 
If the source file is not already installed on the computer: 
    Deferred custom actions of this type must be sequenced after the InstallFiles action. 
    Non-deferred custom actions of this type must be sequenced after the InstallFinalize action. 

入口點自定義操作接收手柄的安裝會話。在執行延期自定義操作期間,會話可能不再存在。要獲取屬性的值,請使用CustomActionData屬性。

這裏是如何在維克斯添加類型18自定義操作:

<Directory Id="TARGETDIR" Name="SourceDir"> 
    <Component Id="Component1" 
      Guid="*"> 
    <File Id="MyCA" Name="MyCA.exe" /> 
    </Component> 
</Directory> 

<CustomAction Id="DoSomething" 
       FileKey="MyCA" 
       ExeCommand="-switch" 
       Execute="deferred" 
       Return="check" 
       HideTarget="no" 
       Impersonate="no" /> 

<InstallExecuteSequence> 
    <Custom Action="DoSomething" Before="InstallFinalize" /> 
</InstallExecuteSequence> 

首先,我們添加MyCA.exe到文件表。

我們還向CustomAction表中添加了類型18的自定義操作。 FileKey屬性指向具有自定義操作dll的元素。 ExeCommand屬性指定可執行文件的命令行字符串。

要做的最後一件事是安排我們的自定義操作在所有必需的序列表中。

這會幫助你出去,有點缺什麼,但我強烈建議你看看所有類型的自定義操作後,這將有助於你做出更多的安裝

+0

這是不夠的,使其工作。有必要將自定義操作安裝到正確的順序點並使用正確的條件來處理升級場景,修復等。:( – user626528 2012-03-12 11:12:38

+0

但是,這可以回答你的問題。它給出瞭如何運行CA提升的清晰指南,並且你是免費的想要進一步發展你的想法 – 2012-03-12 13:08:38

+2

@Yan Sklyarenko,它沒有,這是真正答案的10% – user626528 2012-03-12 13:12:05

5

您可以添加'NOT REMOVE'進行安裝&修理順序。和「安裝和(REMOVE =」ALL「)」僅用於UnInstall序列。

<InstallExecuteSequence> 
     <Custom Action='Install' After='InstallFiles' > 
     NOT REMOVE 
     </Custom> 

     <Custom Action='Uninstall' After='InstallFiles' > 
     Installed AND (REMOVE = "ALL") 
     </Custom> 

    </InstallExecuteSequence> 
0

希望這將是有益的人與維克斯工具集掙扎 標籤:CustomAction,InstallExecuteSequence,維克斯安裝後運行exe文件齊全,內維克斯

二進制或資源文件

雖然,無法找到如何從引導程序

文件名得到完成:Product.wxs

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <Product Id="*" Name="TestingQtExec" Language="1033" Version="1.0.0.0" 
      Manufacturer="My Company" UpgradeCode="PUT-GUID-HERE"> 
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 

    <MediaTemplate EmbedCab="yes" /> 

    <Feature Id="ProductFeature" Title="TestingQtExec" Level="1"> 
     <ComponentGroupRef Id="ProductComponents" /> 
    </Feature> 

    <Binary Id="WixCA1" 
       SourceFile="FTDI.exe"/> 

    <!-- install plugin --> 
    <CustomAction Id="FTDIInstall" 
       BinaryKey ="WixCA1" 
       ExeCommand="/passive" 
       Execute="commit" 
       Return="asyncNoWait" 
       HideTarget="no" 
       Impersonate="no" /> 


    <InstallExecuteSequence> 

     <Custom Action="FTDIInstall" Before="InstallFinalize" /> 
    </InstallExecuteSequence> 

       </Product> 

    <Fragment> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="ProgramFilesFolder"> 
     <Directory Id="INSTALLFOLDER" Name="TestingQtExec" /> 
     </Directory> 
    </Directory> 
    </Fragment> 

    <Fragment> 
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
     <Component Id="cmpSampleTXT" Guid="*"> 
     <File Source="Sample.txt" /> 
     </Component> 
    </ComponentGroup> 
    </Fragment> 
</Wix> 
+0

您可否詳細說明如何回答原始海報問題? – Kmeixner 2016-05-12 18:46:31

相關問題