Can I run a program on release failure in TFS?

0 votes
Is there any way to run a console app on build/release failure in TFS.
Apr 26, 2018 in DevOps & Agile by Atul
• 5,530 points

1 answer to this question.

0 votes

You can try and do the following steps:

  1. 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!");
  2. Add these powershell task inline in the build definition to simulate failure

    Write-Host "HI"

    Write-Error ("ERR")

    exit 1

enter image description here

  1. 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.

enter image description here

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

enter image description here

if your powershell task runs to end the console application won't execute.

enter image description here

answered Apr 26, 2018 by ajs3033
• 7,280 points

Related Questions In DevOps & Agile

+3 votes
2 answers
+1 vote
8 answers

How can I implement process.env in Angular 5 environment?

Users do not have access to process.env ...READ MORE

answered Apr 3, 2018 in DevOps & Agile by DareDev
• 6,850 points
+1 vote
2 answers

How do I run Apache server from Docker without mapping to a location?

If you're seeing a 500 error, that's ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by lina
• 8,200 points
+14 votes
5 answers

How do I run a cron job inside a docker container

If you can SSH into your server ...READ MORE

answered Jul 27, 2018 in DevOps & Agile by Kalgi
• 51,830 points
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,400 points
+1 vote
3 answers

How can I connect an app with an aws ec2 instance?

This is how you deploy a web ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by Hannah
• 18,030 points
0 votes
2 answers

Running a cron job in a docker conratiner

Let’s create a new file called "crontab" ...READ MORE

answered Aug 7, 2018 in DevOps & Agile by Kalgi
• 51,830 points