Here is sample code for creating a Task that can invoke a clickonce application:
using (TaskService ts = new TaskService()) { // Create a new task definition and assign properties TaskDefinition td = ts.NewTask(); td.RegistrationInfo.Description = "runs clickonce app every 10 minutes"; var trigger = new TimeTrigger(); trigger.Repetition.Interval = TimeSpan.FromMinutes(10); // Create a trigger that will fire the task at this time every other day td.Triggers.Add(trigger); // Create an action that will launch the clickonce app td.Actions.Add(new ExecAction("rundll32.exe", @"dfshim.dll,ShOpenVerbApplication your_clickonce_app_url/clickonce_appname.application", null)); // Register the task in the root folder ts.RootFolder.RegisterTaskDefinition(@"ClickOnce app", td); }
source share