I would like to execute a SqlString only on a rollback of a product upgrade. In order to that I am trying to set a property to signal if the product is currently being upgraded. I do it using a custom action that is getting executed depending on UPGRADINGPRODUCTCODE. This custom action is being executed when the first product is uninstalled but not when the second product is installed. As a result during the installation of the second product the property gets its default value and the script will not run on a rollback.

This is the property:
<Property  Id="KMFPRODUCTUPGRADE" Value="NULL" Secure="yes"/>

The is the execute condition:
<Custom Action="CheckIfInProductUpgrade" After="InstallInitialize">UPGRADINGPRODUCTCODE</Custom>

Here is the custom action that sets the value of the property:
<CustomAction Id="CheckIfInProductUpgrade" Property="KMFPRODUCTUPGRADE" Value="KMFPRODUCTUPGRADE"/>

Here is my SqlString, as you can see I am trying to use the KMFPRODUCTUPGRADE to signal if the product is being upgraded: <sql:SqlString SQL=" -- This sequence restores the database in product upgrade if there is a failure if ('[KMFPRODUCTUPGRADE]' = 'KMFPRODUCTUPGRADE' OR '[KMFPRODUCTREINSTALL]' = 'KMFPRODUCTREINSTALL')
                               BEGIN
alter database $(var.DataBaseName) set SINGLE_USER With Rollback Immediate
                                   drop database $(var.DataBaseName)
restore database $(var.DataBaseName) from disk='[TempFolder]$(var.DataBaseName).bak' END" Id="RestoreOnRollBack" SqlDb="$(var.DataBaseName)" RollbackOnReinstall="yes" ContinueOnError="no" RollbackOnInstall="yes"
                           Sequence="40" />


When I look at the verbose log I can see the KMFPRODUCTUPGRADE is set to be NULL in the SqlString.
Any other idea how to do it?
Thank you

=======================================================================
This email, including any attachments, is only for the intended
addressee.  It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
altered or corrupted during transmission.
=======================================================================

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to