How to spawn an offline process from a TFS vNext build step that would last beyond the build?
up vote
0
down vote
favorite
It seems that if my build step spawns a child process, that process cannot survive the end of the build - it is killed.
But I have a scenario where a child process is triggered in order to complete offline certain operations that the build should not wait for their completion (reporting metrics to Azure AppInsights).
This procedure worked fine in XAML builds, but now that we migrated to vNext it is broken, because the child process is killed when the build ends.
What can be done about it?
tfs azure-devops vnext
add a comment |
up vote
0
down vote
favorite
It seems that if my build step spawns a child process, that process cannot survive the end of the build - it is killed.
But I have a scenario where a child process is triggered in order to complete offline certain operations that the build should not wait for their completion (reporting metrics to Azure AppInsights).
This procedure worked fine in XAML builds, but now that we migrated to vNext it is broken, because the child process is killed when the build ends.
What can be done about it?
tfs azure-devops vnext
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
It seems that if my build step spawns a child process, that process cannot survive the end of the build - it is killed.
But I have a scenario where a child process is triggered in order to complete offline certain operations that the build should not wait for their completion (reporting metrics to Azure AppInsights).
This procedure worked fine in XAML builds, but now that we migrated to vNext it is broken, because the child process is killed when the build ends.
What can be done about it?
tfs azure-devops vnext
It seems that if my build step spawns a child process, that process cannot survive the end of the build - it is killed.
But I have a scenario where a child process is triggered in order to complete offline certain operations that the build should not wait for their completion (reporting metrics to Azure AppInsights).
This procedure worked fine in XAML builds, but now that we migrated to vNext it is broken, because the child process is killed when the build ends.
What can be done about it?
tfs azure-devops vnext
tfs azure-devops vnext
asked Nov 11 at 1:06
mark
19.1k55184370
19.1k55184370
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
The easiest way is to schedule a task using the task scheduler.
Example using Microsoft.Win32.TaskScheduler
NuGet package:
using (var ts = new TaskService())
// Create a new task definition and assign properties
var td = ts.NewTask();
td.Triggers.Add(new TimeTrigger(DateTime.Now.AddDays(-1)));
td.Actions.Add(new ExecAction(MyExe, MyArgs));
ts.RootFolder.RegisterTaskDefinition(MyTaskName, td).Run();
ts.RootFolder.DeleteTask(MyTaskName);
The schedule has to be created and auto deleted when completed. Do you happen to know the details of how can this be done from C#? I can probably google it, but these kinds of details will make your answer truly awesome.
– mark
Nov 11 at 18:56
I know :). Haven't had the time to look it up. There are plenty of examples on setting up a scheduled task from powershell. An online powershell script task would do the trick. Depending on its usage I'd either give it a fixed name and just leave it there or use the build definition ID or something to clean it up afterwards. Then pass that id in as a parameter to the schedules task.
– jessehouwing
Nov 12 at 11:03
1
I have taken the liberty to edit your question and add the example code based on what I did for myself. Thanks again.
– mark
Nov 12 at 12:50
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The easiest way is to schedule a task using the task scheduler.
Example using Microsoft.Win32.TaskScheduler
NuGet package:
using (var ts = new TaskService())
// Create a new task definition and assign properties
var td = ts.NewTask();
td.Triggers.Add(new TimeTrigger(DateTime.Now.AddDays(-1)));
td.Actions.Add(new ExecAction(MyExe, MyArgs));
ts.RootFolder.RegisterTaskDefinition(MyTaskName, td).Run();
ts.RootFolder.DeleteTask(MyTaskName);
The schedule has to be created and auto deleted when completed. Do you happen to know the details of how can this be done from C#? I can probably google it, but these kinds of details will make your answer truly awesome.
– mark
Nov 11 at 18:56
I know :). Haven't had the time to look it up. There are plenty of examples on setting up a scheduled task from powershell. An online powershell script task would do the trick. Depending on its usage I'd either give it a fixed name and just leave it there or use the build definition ID or something to clean it up afterwards. Then pass that id in as a parameter to the schedules task.
– jessehouwing
Nov 12 at 11:03
1
I have taken the liberty to edit your question and add the example code based on what I did for myself. Thanks again.
– mark
Nov 12 at 12:50
add a comment |
up vote
1
down vote
accepted
The easiest way is to schedule a task using the task scheduler.
Example using Microsoft.Win32.TaskScheduler
NuGet package:
using (var ts = new TaskService())
// Create a new task definition and assign properties
var td = ts.NewTask();
td.Triggers.Add(new TimeTrigger(DateTime.Now.AddDays(-1)));
td.Actions.Add(new ExecAction(MyExe, MyArgs));
ts.RootFolder.RegisterTaskDefinition(MyTaskName, td).Run();
ts.RootFolder.DeleteTask(MyTaskName);
The schedule has to be created and auto deleted when completed. Do you happen to know the details of how can this be done from C#? I can probably google it, but these kinds of details will make your answer truly awesome.
– mark
Nov 11 at 18:56
I know :). Haven't had the time to look it up. There are plenty of examples on setting up a scheduled task from powershell. An online powershell script task would do the trick. Depending on its usage I'd either give it a fixed name and just leave it there or use the build definition ID or something to clean it up afterwards. Then pass that id in as a parameter to the schedules task.
– jessehouwing
Nov 12 at 11:03
1
I have taken the liberty to edit your question and add the example code based on what I did for myself. Thanks again.
– mark
Nov 12 at 12:50
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The easiest way is to schedule a task using the task scheduler.
Example using Microsoft.Win32.TaskScheduler
NuGet package:
using (var ts = new TaskService())
// Create a new task definition and assign properties
var td = ts.NewTask();
td.Triggers.Add(new TimeTrigger(DateTime.Now.AddDays(-1)));
td.Actions.Add(new ExecAction(MyExe, MyArgs));
ts.RootFolder.RegisterTaskDefinition(MyTaskName, td).Run();
ts.RootFolder.DeleteTask(MyTaskName);
The easiest way is to schedule a task using the task scheduler.
Example using Microsoft.Win32.TaskScheduler
NuGet package:
using (var ts = new TaskService())
// Create a new task definition and assign properties
var td = ts.NewTask();
td.Triggers.Add(new TimeTrigger(DateTime.Now.AddDays(-1)));
td.Actions.Add(new ExecAction(MyExe, MyArgs));
ts.RootFolder.RegisterTaskDefinition(MyTaskName, td).Run();
ts.RootFolder.DeleteTask(MyTaskName);
edited Nov 12 at 12:52
mark
19.1k55184370
19.1k55184370
answered Nov 11 at 10:31
jessehouwing
66k9158230
66k9158230
The schedule has to be created and auto deleted when completed. Do you happen to know the details of how can this be done from C#? I can probably google it, but these kinds of details will make your answer truly awesome.
– mark
Nov 11 at 18:56
I know :). Haven't had the time to look it up. There are plenty of examples on setting up a scheduled task from powershell. An online powershell script task would do the trick. Depending on its usage I'd either give it a fixed name and just leave it there or use the build definition ID or something to clean it up afterwards. Then pass that id in as a parameter to the schedules task.
– jessehouwing
Nov 12 at 11:03
1
I have taken the liberty to edit your question and add the example code based on what I did for myself. Thanks again.
– mark
Nov 12 at 12:50
add a comment |
The schedule has to be created and auto deleted when completed. Do you happen to know the details of how can this be done from C#? I can probably google it, but these kinds of details will make your answer truly awesome.
– mark
Nov 11 at 18:56
I know :). Haven't had the time to look it up. There are plenty of examples on setting up a scheduled task from powershell. An online powershell script task would do the trick. Depending on its usage I'd either give it a fixed name and just leave it there or use the build definition ID or something to clean it up afterwards. Then pass that id in as a parameter to the schedules task.
– jessehouwing
Nov 12 at 11:03
1
I have taken the liberty to edit your question and add the example code based on what I did for myself. Thanks again.
– mark
Nov 12 at 12:50
The schedule has to be created and auto deleted when completed. Do you happen to know the details of how can this be done from C#? I can probably google it, but these kinds of details will make your answer truly awesome.
– mark
Nov 11 at 18:56
The schedule has to be created and auto deleted when completed. Do you happen to know the details of how can this be done from C#? I can probably google it, but these kinds of details will make your answer truly awesome.
– mark
Nov 11 at 18:56
I know :). Haven't had the time to look it up. There are plenty of examples on setting up a scheduled task from powershell. An online powershell script task would do the trick. Depending on its usage I'd either give it a fixed name and just leave it there or use the build definition ID or something to clean it up afterwards. Then pass that id in as a parameter to the schedules task.
– jessehouwing
Nov 12 at 11:03
I know :). Haven't had the time to look it up. There are plenty of examples on setting up a scheduled task from powershell. An online powershell script task would do the trick. Depending on its usage I'd either give it a fixed name and just leave it there or use the build definition ID or something to clean it up afterwards. Then pass that id in as a parameter to the schedules task.
– jessehouwing
Nov 12 at 11:03
1
1
I have taken the liberty to edit your question and add the example code based on what I did for myself. Thanks again.
– mark
Nov 12 at 12:50
I have taken the liberty to edit your question and add the example code based on what I did for myself. Thanks again.
– mark
Nov 12 at 12:50
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244947%2fhow-to-spawn-an-offline-process-from-a-tfs-vnext-build-step-that-would-last-beyo%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown