Book Image

WiX Cookbook

By : Nicholas Matthew Ramirez
1 (1)
Book Image

WiX Cookbook

1 (1)
By: Nicholas Matthew Ramirez

Overview of this book

Table of Contents (20 chapters)
WiX Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a scheduled task


Adding a scheduled task to the system allows us to perform some action, such as running an executable, at a specific time each hour, day, or month. It might be to clean up old log files, check for software updates, or process a batch file. With WiX, we can add a scheduled task at the time of installation and remove it when our software is uninstalled.

In this recipe, we'll add a simple task that calls the calculator program once per day. We'll also include markup to remove the task if the installation should fail, or if the user decides to uninstall our software.

Getting ready

To prepare for this recipe, perform the following steps:

  1. Create a new setup project and call it ScheduledTaskInstaller.

  2. For an installer to succeed, it must install at least one file. Add a text file called Sample.txt to the project and then add a Component and File element to it:

    <ComponentGroup Id="ProductComponents"  
                    Directory="INSTALLFOLDER">
      <Component Id="cmpSampleTXT...