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?
Custom Action execution by feature
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
Add to your Install execute sequence.
<![CDATA[&SWUSchedTaskFeature=3]]> –
Kirby
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)
"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 ]]>
© 2022 - 2024 — McMap. All rights reserved.