我正在執行WIX MSI slient安裝,並且還有一些自定義操作檢查兩者之間是否存在未能如何回滾或結束msi的簡單安裝過程? ?我正在複製文件,並使用Wix安裝啓動Windows服務。當以前的customaction失敗,我可以如何停止創建目錄和啓動windows服務?Wix靜默安裝MSI可以阻止目錄的創建
[CustomAction]
public static ActionResult PrerequisiteCheck(Session session)
{
if (Status.IsServiceAvailable && Status.IsPrinter)
{
return ActionResult.Success;
}
else
{
//Stop Installer
return ActionResult.Failure;
}
}
<CustomAction Id="CheckPrerequiste" BinaryKey="BIN_CustomAction" DllEntry="CheckPrerequiste" Return="ignore" Execute="immediate" />
<InstallExecuteSequence> <Custom Action="CA_PrerequisiteCheck" After="InstallExecute" > </Custom>
</InstallExecuteSequence>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="Service">
<Component Id="WindowsService" Guid="AA34D3C1-26F1-4A7E-A226-1AB01501C67C">
<File Id="00690A65EA1A3EFEB7607285DBA0C8C5" KeyPath="yes" Source="WindowsService.Svc.exe" />
<ServiceInstall Id="Service" Name="Service" DisplayName="Windows Service" Description="Windows Service" Start="auto" ErrorControl="normal" Type="ownProcess" />
<ServiceControl Id="sc_Service" Name="Service" Stop="both" Remove="uninstall" Wait="yes" />
<Component Id="WindowsSvcexe" Guid="06ABF18B-DEDE-4D98-AF9F-8384539A6BC3"> <File Id="49215CE1A25380930C771772AD14519B" KeyPath="yes" Source="WindowsService.Svc.exe.config" /> </Component> </Component>
</Directory>
</Directory>
</Directory>
我個人發現,讓整個安裝失敗並回滾最簡單,然後嘗試排除故障並修復自定義操作導致其失敗的問題。現在,如果您正在檢查先決條件,也許可以爲需要先決條件的組件創建功能,如果它們不符合先決條件,請將其禁用。 – jcmcbeth