You will increase your success rate by doing these things:
 - Get rid of your self-registration and use the built-in Windows platform
support for services (the Service* elements in WiX).
    * the above will require that you perform all your registration using
Registry entries, etc. in the MSI itself instead of using the stuff only
intended for developers debugging their code builds (self-registration)
without doing the smart thing which is remote debugging using a virtual
image.
  - Move RemoveExistingProducts to either right before or right after
InstallFinalize.

With the way you have your installation authored your previous version
should be reinstalled when the removal is rolled back. Your new package
shouldn't care if this is an upgrade or a fresh install since you currently
"remove-before-install" your upgrade.

-----Original Message-----
From: Adriana Rodean [mailto:adrya1...@gmail.com] 
Sent: Thursday, December 10, 2009 3:41 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] install previous version when service major upgrade
fails

Hi,

I have the following scenario.
- MSI installs a service.
- MSI makes MAJOR upgrade to this installed service (uninstalls old
version and installs new version)
- During the major upgrade if it fails, it makes rollback and the
service uninstalls completely.
Is it possible to tell MSI that if service major upgrade fails,
uninstall the upgrade and install the previous version of the service?
And how?

This is my code:

    <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>


Another question. How can i make rollback action (RunCmdRollback) not
to execute on failed upgrade, only on failed new install?

Thank you very much,
Adriana

----------------------------------------------------------------------------
--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to