You can try and do the following steps:
- Check in to the console app by simply printing a random line like('it's running'). You can check in and make it copy the build/release agent
Console.WriteLine("Console app has run!");
Add these powershell task inline in the build definition to simulate failure
- add the run command line task giving path to console app. Now, the control option is already set to run this task only when an earlier task has failed to execute.
If the powershell task and the build fails, by default the next task will not run, but since the console application task is executed only when the previous task fails, your task will run
if your powershell task runs to end the console application won't execute.