Tuesday, 2 November 2010

TeamCity, Nunit, .net sln build - A simple how to

We have installed TeamCity for our CI needs and very nice it is too. However, when we came to get it to run our nUnit tests we found it very hard to find an example of the most simple way to get this working. The TeamCity documentation is not clear at all if you are MSBuild newbies like us.

So, to save you the pain, here is how it works

You need to realise first of all that you need to make an MSBuild script which will build your .sln file and also run the nunit tests

Then when you configure your project in TeamCity at the Runnner:MSBuild page point the 'Build File Path' to your msbuild file. We checked this msbuild file into subversion.

In order to get TeamCity to run the tests this is what the MSBuild file should look like what is shown below

Please note that when we put ANY rather than v2.0 in the exec line, we got nunit errors

Please also not this is a starting point and we know nothing of MSBuild so I am sure there are many other ways of doing this.... Hope this helps!