[wix-users] Run custom action only during modify
Edwin Castro
egcastr at gmail.com
Thu Feb 27 10:05:50 PST 2020
You cannot read any properties in a deferred action running in the execute
sequence. There are a very small set of exceptions but so small and
specific that I'd recommend assuming no properties can be read in
deferred custom actions.
If you are trying to read the property in an immediate custom action then
I'd question if WixUI_UninstallMode is set ONLY in the InstallUISequence.
Ah! It seems private properties set in the InstallUISequence are not
available in the InstallExecuteSequence.
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/InstallExecuteSequence-and-properties-from-UI-td4718706.html
You could schedule an action in the InstallUISequence that writes the value
of WixUI_UninstallMode to a public property and then it should be available
in the InstallExecuteSequence. Alternatively, you could just calculate the
value yourself in the InstallExecuteSequence directly.
--
Edwin G. Castro
On Thu, Feb 27, 2020 at 9:53 AM Satya <gsnreddy1234 at gmail.com> wrote:
> I tried to read it in a custom action(vbscript) in execute sequence as
> below.
>
> Property ("WixUI_UnstallMode")
>
>
> Wrote a message box to display above property value in the custom action.
> I will provide the install log tomorrow.
>
>
>
> On Thu, 27 Feb, 2020, 10:18 PM Edwin Castro, <egcastr at gmail.com> wrote:
>
>> Perhaps you were trying to read WixUI_InstallMode too early (before it
>> was set) or too late (in a different sequence or deferred)?
>>
>> How is it not working? Can you explain exactly how you're reading it and
>> when? Can you provide a log?
>>
>> --
>> Edwin G. Castro
>>
>>
>> On Thu, Feb 27, 2020 at 3:51 AM Satya <gsnreddy1234 at gmail.com> wrote:
>>
>>> Hi Edwin and Vladimir,
>>>
>>> I haven't tried the suggestions shared by you yet. Before that I would
>>> like to know whether it is possible to use "WixUI_InstallMode" property. I
>>> observed that this private property holds the correct value based on the
>>> installation type.
>>>
>>> Example:
>>> MSI (c) (1C:5C) [16:58:07:499]: PROPERTY CHANGE: Adding
>>> WixUI_InstallMode property. Its value is 'Change'.
>>>
>>> Can we use this property? I tried to read it like other public
>>> properties but it's not working.
>>>
>>> Regards,
>>> Satya
>>>
>>> On Thu, Feb 27, 2020 at 12:43 AM Edwin Castro via wix-users <
>>> wix-users at lists.wixtoolset.org> wrote:
>>>
>>>> Satya,
>>>>
>>>> This might be a helpful resource too!
>>>>
>>>>
>>>> https://code.dblock.org/2010/05/11/msi-property-patterns-upgrading-firstinstall-and-maintenance.html
>>>>
>>>>
>>>> --
>>>> Edwin G. Castro
>>>>
>>>> On Wed, Feb 26, 2020 at 12:14 AM Vladimir Kolobkov via wix-users <
>>>> wix-users at lists.wixtoolset.org> wrote:
>>>>
>>>> > Hello Satya,
>>>> >
>>>> > Not sure that i know how to do it the right way.
>>>> > But you can test features of your msi for current state, and if at
>>>> least
>>>> > one is already installed then you are probably in the change/modify or
>>>> > uninstall.
>>>> > Not sure about repear or upgrade or patch but it can be tested :).
>>>> >
>>>> > For example:
>>>> > <Custom Action="*%Action you need to run%*" Before="*%any action%*
>>>> > "><![CDATA[(&*%FTR_Name%* = 3 AND !*%FTR_Name%* <> 3) AND UILevel < 4
>>>> AND
>>>> > NOT (REMOVE ~= "ALL")]]></Custom>
>>>> > As i remember:
>>>> > - this action runs on silent mode( UILevel < 4 )
>>>> > - not for uninstall( NOT (REMOVE ~= "ALL") )
>>>> > - if feature "FTR_Name" action is INSTALLSTATE_LOCAL(&*%FTR_Name%* =
>>>> 3)
>>>> > - and if feature "FTR_Name" current state is not INSTALLSTATE_LOCAL(!
>>>> > *%FTR_Name%* <> 3)
>>>> >
>>>> > probably you need to check current state only and not the action.
>>>> >
>>>> > Here are additional links for help with conditions:
>>>> >
>>>> >
>>>> https://docs.microsoft.com/en-us/windows/win32/msi/conditional-statement-syntax?redirectedfrom=MSDN#feature-and-component-state-values
>>>> >
>>>> >
>>>> >
>>>> https://docs.microsoft.com/en-us/windows/win32/msi/examples-of-conditional-statement-syntax
>>>> >
>>>> >
>>>> > Best regards,
>>>> > Vladimir Kolobkov
>>>> >
>>>> >
>>>> > On Wed, 26 Feb 2020 at 06:18, Satya via wix-users <
>>>> > wix-users at lists.wixtoolset.org> wrote:
>>>> >
>>>> > > Can anyone help me with this?
>>>> > >
>>>> > > On Wed, 19 Feb, 2020, 9:10 PM SNR Gopu, <gsnreddy1234 at gmail.com>
>>>> wrote:
>>>> > >
>>>> > > > Hi,
>>>> > > >
>>>> > > > I have a custom action which needs to be executed only during
>>>> modify.
>>>> > The
>>>> > > > below condition is working fine when user selects "Change" option
>>>> by
>>>> > > > launching the MSI.
>>>> > > >
>>>> > > > *Installed AND NOT REINSTALL AND NOT REMOVE~="ALL"*
>>>> > > >
>>>> > > > But, if the user selects the "Change" option from add/remove
>>>> programs,
>>>> > > the
>>>> > > > custom action is not being executed. Could you please let me know
>>>> the
>>>> > > > condition that I need to use in this scenario?
>>>> > > >
>>>> > > > Regards,
>>>> > > > Satya
>>>> > > >
>>>> > >
>>>> > > ____________________________________________________________________
>>>> > > WiX Toolset Users Mailing List provided by FireGiant
>>>> > > http://www.firegiant.com/
>>>> > >
>>>> >
>>>> > ____________________________________________________________________
>>>> > WiX Toolset Users Mailing List provided by FireGiant
>>>> > http://www.firegiant.com/
>>>> >
>>>>
>>>> ____________________________________________________________________
>>>> WiX Toolset Users Mailing List provided by FireGiant
>>>> http://www.firegiant.com/
>>>>
>>>
More information about the wix-users
mailing list