user350332
user350332

Reputation: 173

Add an option to enable or disable a feature during installation process using wix

Hi I have written code for my wix project such that it creates and deletes a schedule task on install or uninstall respectively. But I want to give the users an option(Feature) during installation where they enable or disable the task to get created not. My code so far shows the option but creates the task even when I select disable.

Upvotes: 1

Views: 245

Answers (2)

user350332
user350332

Reputation: 173

<InstallExecuteSequence> 
<Custom Action="CreateScheduledTask" Before="InstallFinalize">
    <![CDATA[&CreateScheduledTask=3]]>
</Custom>
</InstallExecuteSequence>

Upvotes: 1

Charles Gargent
Charles Gargent

Reputation: 1807

The feature level for your scheduled task is 1, your installlevel is going to be 1 or more, therefore this feature will always install. When your user selects an option it has to change the installlevel

Here is further info on features etc

here is your code in better formatting.

<Component Id='ScheduledTask' Guid='{ABDBFC55-F5DF-4DC9-92FF-DD9C7A5D4880}' KeyPath='yes'> 
    <File Source="../../apps/bin/Release/Swu.exe"></File> 
</Component> 
<Feature Id="SWUSchedTaskFeature" Title="Create a scheduled task" Level="1" Absent="allow" TypicalDefault="install" Description="Creates and configures Scheduled Task for the SWU application" Display="expand" AllowAdvertise="no">
    <ComponentRef Id="ScheduledTask"/>
</Feature>

Upvotes: 2

Related Questions