Custom Action execution by feature
Asked Answered
K

4

9

I wrote a custom action to create a scheduled task after install. I do not want the Custom Action to run when the user does not want to create the schedule task. During installation even if I select " Feature will be unAvailable" the schtask is getting created. How do i prevent the Custom Action from executing?

Kirby answered 21/6, 2010 at 19:57 Comment(0)
M
14

You can set a condition for your CA execution:

<InstallExecuteSequence>
    <Custom Action="ScheduleTaskCA" After="InstallFinalize">
        <![CDATA[&feature_name=3]]>
    </Custom>
</InstallExecuteSequence>

Hope it helps.

If you want to read more about CAs conditions, you can chech the link below. Advanced Custom Action Conditions

Medallion answered 28/6, 2010 at 21:7 Comment(0)
K
0

Add to your Install execute sequence.

Kirby answered 22/6, 2010 at 13:48 Comment(1)
<![CDATA[&SWUSchedTaskFeature=3]]>Kirby
F
0

Actually I found out the problem. The &FeatureName = 3 tells me that the feature is to be installed, and the opposite to that, is !FeatureName = 3, which means the feature is installed already. This fixed my problem so the final solution became

&FeatureName = 3 OR (!FeatureName  = 3 AND NOT (Uninstalling OR MSIPATCHREMOVE OR RemovingForUpgrade)    
Fredenburg answered 18/2, 2015 at 12:55 Comment(0)
F
0

"MyService" is feature Name

"FEATURE_MyService" is my condition Name: I am using checkbox to set the value of FEATURE_MyService property

<Control Id="Chk1" Type="CheckBox" Height="12" Width="110" X="50" Y="199" Text="Portal Windows Service" Property="FEATURE_MyService" CheckBoxValue="0" Hidden="yes">

<Custom Action='CAction1' After="InstallExecute">
    NOT Installed AND <![CDATA[(&MyService=3)]]>

<Custom Action='CAction2' Before='InstallExecute'>
    <![CDATA[(&MyService=3 AND NOT Installed)]]>

<Custom Action='CAction3' After='InstallFinalize'>
    <![CDATA[FEATURE_MyService AND NOT Installed ]]>

Ferri answered 14/5, 2015 at 12:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.