Clearing a hung build in TeamCity

We recently had a build that was hung on TeamCity.  When we cancelled it, the build just stayed around saying it was cancelling.  After googling for the solution, I couldn’t find one.  So this is what I did to clear it.

Go into team city and find the directory and machine that the build is on (assuming you’re using multiple build agents).  It will be something like C:\TeamCity\buildAgent\work\dc426554e8b0f33.   Stop the Build Agent on that machine,

  • net stop “TeamCity Build Agent Service”
  • Delete the offending dir.
  • net start “TeamCity Build Agent Service”

Then go to the webserver machine and do this;

  • net stop “TeamCity Web Server”
  • net start “TeamCity Web Server”

I hope this helps someone.

string.Format and curly brackets throwing “Input string was not in a correct format.”

I just fell into what seems a newbie C# programming pitfall, so I thought I’d document it for someone else’s learning pleasure.

Using string.Format() to create a string (ala printf), I was hit by the exception “Input string was not in a correct format.” Here’s an example of the problem;

string.Format("{0}/{id}", "controller");

While its may seem obvious that its the second curly braces, it does seem silly that it doesn’t figure this out correctly. Here’s the solution;

string.Format("{0}/{{id}}", "controller");

Which now does look silly, but it works.

Enjoy.