2009-12-10 46 views
1

我有以下情況。當服務主要升級失敗時安裝以前的版本

  • MSI安裝服務。
  • MSI使重大升級到此安裝服務(卸載舊版本並安裝新版本)
  • 在重大升級,如果它失敗了,這讓回滾和服務完全卸載。

是否可以告訴MSI如果服務主要升級失敗, 卸載升級並安裝以前版本的服務? 又如何?

這是我的代碼:

<CustomAction Id="SetCustomActionDataValue" Return="check" 
Property="RunCmdRollback" Value="[INSTALLDIR], [UPGRADINGPRODUCTCODE], 
[OLDFOUND]" /> 

    <CustomAction Id="RunCmdRollback" BinaryKey="OPGInstallerCA2.dll" 
DllEntry="CustomAction1" Execute='rollback' Return="ignore" 
Impersonate='no'/> 

    <CustomAction Id='InstallServiceSetProp' Property='InstallService' 
Value='/installtype=notransaction /action=install /LogFile= 
"[#WindowsService]" "[#ConfigFile]"' /> 
    <CustomAction Id='InstallService' BinaryKey='InstallUtil' 
DllEntry='ManagedInstall' Execute='deferred' Return='ignore' 
Impersonate='no' /> 

    <CustomAction Id='UnInstallServiceSetProp' 
Property='UnInstallService' Value='/installtype=notransaction 
/action=uninstall /LogFile= "[#WindowsService]" "[#ConfigFile]"' /> 
    <CustomAction Id='UnInstallService' BinaryKey='InstallUtil' 
DllEntry='ManagedInstall' Execute='deferred' Return='ignore' 
Impersonate='no'/> 

    <CustomAction Id='CommitServiceSetProp' Property='CommitService' 
Value='/installtype=notransaction /action=commit /LogFile= 
"[#WindowsService]" "[#ConfigFile]"' /> 
    <CustomAction Id='CommitService' BinaryKey='InstallUtil' 
DllEntry='ManagedInstall' Execute='commit' Return='ignore' 
Impersonate='no' /> 

    <CustomAction Id='RollbackServiceSetProp' 
Property='RollbackService' Value='/installtype=notransaction 
/action=rollback /LogFile= "[#WindowsService]" "[#ConfigFile]"' /> 
    <CustomAction Id='RollbackService' BinaryKey='InstallUtil' 
DllEntry='ManagedInstall' Execute='rollback' Return='ignore' 
Impersonate='no' /> 

    <CustomAction Id='ConfigurePort' Execute='deferred' 
Return='ignore' BinaryKey='HTTPCFG' ExeCommand='set urlacl -u 
http://+:55555/OPGatewayService/ -a D:(A;;GA;;;NS)' Impersonate='no'/> 
    <CustomAction Id='UnConfigurePort' Execute='deferred' 
Return='ignore' BinaryKey='HTTPCFG' ExeCommand='delete urlacl -u 
http://+:55555/OPGatewayService/' Impersonate='no'/> 
    <CustomAction Id='RollbackConfigurePort' Execute='rollback' 
Return='ignore' BinaryKey='HTTPCFG' ExeCommand='delete urlacl -u 
http://+:55555/OPGatewayService/' Impersonate='no'/> 

    <CustomAction Id="StopVCA" Execute='rollback' Return='ignore' 
ExeCommand="net stop OPGatewayService" Directory="TARGETDIR" 
Impersonate='no' /> 


    <InstallExecuteSequence> 


    <InstallValidate Sequence="1400" /> 
    <RemoveExistingProducts Sequence="1402">OLDFOUND</RemoveExistingProducts> 
    <InstallInitialize Sequence="1500" /> 

    <Custom Action="ConfigurePort" 
After='InstallService'>$OPGatewayComponent>2</Custom> 
    <Custom Action="UnConfigurePort" 
After='UnInstallService'>$OPGatewayComponent=2</Custom> 

    <Custom Action='InstallServiceSetProp' 
Before='StartServices'>$OPGatewayComponent>2</Custom> 
    <Custom Action='InstallService' 
After='InstallServiceSetProp'>$OPGatewayComponent>2</Custom> 

    <Custom Action='UnInstallServiceSetProp' 
After='StopServices'>$OPGatewayComponent=2</Custom> 
    <Custom Action='UnInstallService' 
After='UnInstallServiceSetProp'>$OPGatewayComponent=2</Custom> 

    <Custom Action='CommitServiceSetProp' 
After='RollbackService'>$OPGatewayComponent>2</Custom> 
    <Custom Action='CommitService' 
After='CommitServiceSetProp'>$OPGatewayComponent>2</Custom> 

    <Custom Action='RollbackServiceSetProp' 
After='InstallService'>$OPGatewayComponent>2</Custom> 
    <Custom Action='RollbackService' 
After='RollbackServiceSetProp'>$OPGatewayComponent>2</Custom> 
    <Custom Action="StopVCA" 
After='RollbackService'>$OPGatewayComponent>2</Custom> 
    <Custom Action='RollbackConfigurePort' 
After='StopVCA'>$OPGatewayComponent>2</Custom> 
    <Custom Action='SetCustomActionDataValue' 
After='RollbackConfigurePort'>$OPGatewayComponent>2</Custom> 
    <Custom Action="RunCmdRollback" After='SetCustomActionDataValue' 
>$OPGatewayComponent>2</Custom> 

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

    </InstallExecuteSequence> 

另一個問題。我如何使回滾操作(RunCmdRollback)不是 在失敗的升級時執行,僅在失敗的新安裝上執行?

非常感謝你, 阿德里安娜

回答

0

是否有您無法使用維克斯的ServiceInstallServiceControl元素的一個原因?

它看起來像你讓事情的方式比他們需要的更復雜。