When you’ve used TFS and visual studio you can link to a work item (Bug, Product backlog item etc.) bij using a #<number> in your commit message. After that it will display a link to your commit that you can click on. Which is really cool but we’re using TeamCity as a buildserver for one of our projects which doesnt support this, or does it…

This took me a while googling about this and eventually I found out that I was using the wrong search words. So let’s see how we configure this. In the team city installation directoy on the server you have to go to the Data Directory., You can see this path when you go to “Admin Panel” -> “Global settings”.

Navigate the data directory folder on the server and open the main-config.xml file. But before you change anything make a back-up. The settings screen looks like this:

The folder is highlighted in this screenshot. Next we open the config/main-config.xml file and add a transformation pattern. An example of this can be seen below:

<transformation-pattern
       search="#(\d+)"
       replace="<a target="_blank" title="Click to open this issue a new window" href="
       https://<url>/_workitems/edit/$1">$1</a>"
       description="Devops issue link" />
  </comment-transformation>

This pattern matches “#<number>” in the commit message and transforms that to a link to Azure DevOps in my case. This can of course be changed to anything you want. The value in the replace string needs to have html entities to allow reserved characters.

Late edit:

Today I discovered that you can also edit there files from the web-ui of teamcity. If you go to to “Administration” -> “Diagnostics” you can also browse the data directory

if you want more infornation you can find it here.

Leave a Reply

Your email address will not be published. Required fields are marked *