How to reset your administrator password in Teamcity 8.0

Yeah, it could happen to any of us. You setup TeamCity 8.0 as a continuous integration server a while ago. It runs perfectly fine, it runs so fine that you never need to log on as an administrator any more. You even forget that it exists, you even forget YOUR PASSWORD!panic

Now what? Reinstall everything? Try to hack the database? Use some cryptic java commands? What? What?

SupermanNo panic needed, the nice people at JetBrains already thought about this. There is a Super-user token that allow you to get back to the server UI with system administrator permissions.

Go and get the token from the teamcity-server.log file (search for “Super user authentication token” text).

After that you just need to:

  1. Go to <TeamCity server URL>/login.html?super=1
  2. Enter the Super-user token.
  3. Enjoy the rest of your day



How to remove a project from TFS Preview

By now you probably know that Microsoft is offering a FREE preview of TFS online. If you have a Microsoft account (previously Live Id), you already have a TFS account. Just sign in and start playing using the features!

So much usage will probably leave a few projects on your account that you don’t need at all. Time for some cleanup.
But, how do you delete a project from your TFS Preview account????

  • Open a VS2012 command prompt in administrator mode
  • Go to %programfiles%\Microsoft Visual Studio 11.0\Common7\IDE
  • Execute the following command (replace myproject and projectname with your values): tfsdeleteproject/collection:"" projectname

You might be prompted for your credentials and to confirm your request:

Warning: Deleting a team project is an irrecoverable operation. All version control, work item tracking and Team Foundation build data will be destroyed from the system. The only way to recover this data is by restoring a stored backup of the databases. Are you sure you want to delete the team project and all of its data (Y/N)?Y

Just hit Y and enjoy!


How to convert string to Enum in C#

This is a common task for C# programmers. You have a string value and need to convert it to the equivalent Enum value. Piece o’ cake: code some nifty switch statement or maybe a bunch of if / else conditions to test for every possible match, right? … er, NO.

Say you have declared an Enum like:

public enum FeedBackMessageType
None = 0,

Then you should be able to convert a string like:

var feedbackMessageType = (FeedBackMessageType) Enum.Parse(typeof(FeedBackMessageType), "Success", true);

If you are trying to convert a string that doesn’t match any of values from the enum, you will get a ArgumentException. How to avoid this? Try:

var invalidMessageType = "Info";
var feedbackMessageType = Enum.IsDefined(typeof(FeedBackMessageType), invalidMessageType)
    ? (FeedBackMessageType) Enum.Parse(typeof(FeedBackMessageType), invalidMessageType , true)
    : FeedBackMessageType.None;

One caveat, the IsDefined method has no ignore case parameter. According to MSDN: The characters in the string must have the same case as the enumeration member name. :/