I am pleased to be able to say that TeamCitySharp is now supports mono. In order to get the project supported I had to change a few parts of the system.
Up until now, each project within the solution has a “BeforeBuild” event that downloaded the nuget packages needed to build the solution. This was in place to keep the github repository small enough to facilitate a fast download for people who fork it. Nuget doesn’t work with mono so there was a trade off I had to make. In this instance I chose supporting mono over the “BeforeBuild” event. This does mean that once the repository is cloned or forked. then it will work instantly. I hope to revisit this if / when someone manages to get nuget working with mono.
The sample build monitor was a standard ASP.NET MVC 3 project. I found that this didn’t build with mono out of the box. It was throwing errors due to the references contained. The following references were present:
On running a reference analysis, I was able to see that the following references were not used:
This meant that only the core references were left behind. This meant that the entire solution was able to build under mono.
In order to build the project with mono, you can run the following command:
Hot on the heels of the first release of TeamCitySharp, a new update has been released for the project to nuget. There were 2 major additions to the project both contributed via pull requests on Github.
Introduction of Build Locator
This makes the protocol for obtaining build information easier as we use the locator in the url rather than trying to build a query string manually. Previously we built a query string as follows:
This would get the successful builds for build config id 437. This has now been replaced by the following query string:
Thanks must go to Simon Bartlett for this addition to the codebase. The existing methods will work in this way as the code behind the public methods has been changed to us the build locator pattern. Therefore you can still call the method:
Behind the scenes TeamCitySharp does the following call:
New Sample Build Monitor
There is now a new project included in the source code. This project is a sample implementation of a build monitor using TeamCitySharp based on MVC3 and Knockout.js. Thanks to Barry Mooring for contributing this sample to the project.
In order to use the build monitor you just need to go to the settings file and add the TeamCity url, username and password.
This gives a look and feel as follows:
You can download the source from Github or via nuget (install-package TeamCitySharp). Please feel free to leave feedback about what you feel it is lacking or what you don’t like about the project. This library will only be able to get better through help from users.
TeamCitySharp (TCS) is a simple .net wrapper that will let you interact with a TeamCity server providing you have a login for that system. TeamCity has a REST API but this wrapper will help simplify the calls that that API and deserialize the response for the server into POCOs for you.
In order to get a list of projects on a TeamCity server you would make the request to the following URL:
In order to interact with this, you could use EasyHTTP or HTTP WebRequest. You would set up a connection, specify a content type, give user credentials and then get a response back that you can use. TeamCitySharp has taken care of this for you. The corresponding code to make the same code using TeamCitySharp would be as follows:
There are a number of methods available that will let you get projects, build status’, build types, users, agents, user groups and server information. The project cannot be used to create projects or build types. This is due to the absence of the appropriate calls on the TeamCity REST API. A full list of functionality of the TeamCitySharp API calls can be found in the documentation.
I have created a TeamCitySharp nuget package and you can install that from nuget command line using the comment:
This is very much an early version of the project in order to get user feedback. If you do try it then please do let me know what you don’t like about it and what you feel it would benefit from. Thanks really must go to Hadi Hariri for the idea after I saw YouTrackSharp.
Please feel free to fork the project and send any requests back you feel the project would benefit from. The project is distributed under the MIT license so please adhere to this when using it.