Building a software assembly line with the TeamCity Continuous Integration Server for .NET and Visual Studio 2010

by Klaus Graefensteiner 31. May 2011 07:38

Sanity check

Two development centers, unit tests that are actually integration tests, which depend on a complex distributed architecture that is far from bullet proof itself, two sets of test systems, two sets of test scripts running the same set of tests, test result reporting in the format of XML files, build process notifications via email, comparing test results manually, failing tests being ignored for weeks, builds breaking, and breaking and breaking… Does this sound familiar? For your sanity sake, I hope not. Continuous Integration CI is the remedy for the software production chaos. This blog post is a starting point into a new software live.

The idea

Integration

Figure 1: Precision, Timing and repeatability are the foundation for efficient software production.

Reading Martin Fowler’s article about Continuous Integration is the best way to get familiar with the idea.

The tools

Continuous Integration has its foundation in automation. That includes compilation, tests and analytics, packaging, staging and deployment. It doesn’t have to be all of theses steps and in most cases it is compilation, tests and analytics. Here is a list of tools that you would need:

Must have

TeamCity – Continuous Integration Server

VisualSVNServer – Subversion source control server

Visual Studio 2010 – Integrated Development Environment

VisualSVN – Visual Studio source control integration with SubVersion

Nant – Build scripting runtime

NUnit – .NET unit testing framework

NCover – Code coverage analyzing and reporting tool

ReSharper – Visual Studio coding assistant.

FxCop – Coding style analyzer is part of the Windows SDK

PowerShell – Windows automation environment. Ships on board of Windows 7 and Windows 2008 R2 and can be downloaded here for other versions of Windows.

Optional

Tree Surgeon – A little bit out dated, but a good start for getting started with automated builds.

MySQL – Use this if you want your TeamCity server run off a “real” database.

Note: MySQL can be installed and configured by the click of a button, if you are using the Web Platform Installer and select to install WordPress.

The learning resources

Screen casts

The quickest way to get started is to watch some of the DimeCasts.Net web casts. I recommend to start with the Nant ones, if you are new to build automation and build scripts. They tie straight into the screen casts that talk about TeamCity.

Note: There are many great 10 minute screencasts about .NET development on their site. Here is a link to their archive.

Building a Nant Script -- Part 1: Setting up the script

Building a Nant Script -- Part 2: Adding NUnit tests

Building a Nant Script -- Part 3: Adding Code Coverage w/ NCover

Building a Nant Script -- Part 4: Running SQL Scripts w/ SqlCmd

Building a Nant Script -- Part 4: Adding fxCop to your build script

Creating Custom Functions w/ NAnt

Building a NAnt script - Part 5: Adding MSTest results to your build scripts

Learning Nant: Creating Token Driving Configuration Files

Introduction to NDepend, adding NDepend to your Nant Script

Setting up Continuous Integration for your Application with Team City

Book

There is a book about continuous integration with .NET. It is a little big sparse for my taste. It tries to cover too many CI products and only scratches the surface on each.

The title of the book is: Continuous Integration in .NET

Others

The TreeSurgeon CodePlex project comes with a nice set of blog posts that describe some basic build automation concepts.

And of course there is the TeamCity documentation.

The pilot deployment

To get familiar with TeamCity, I am setting up a little sandbox environment. I am using the xmlrpc.net open source project, that is hosted by  a subversion server in the cloud. I downloaded and installed TeamCity 6.5 on a Windows 2008 R2 server. This machine also has MySQL installed. I configured TeamCity to use MySQL as database server. I am also using the same machine as a build agent. I have Nant and NUnit installed. Besides that I am using NCover and FxCop to do some code analysis.

My development machine has Visual Studio 2010 SP1, ReSharper 5 and VisualSVN installed.

Note: I am planning on writing a few follow up blog posts that will report about my experience with this setup. Stay tuned. I am already working on one that describes how to switch the TeamCity database to MySQL.

Ausblick

LabPress

Software building is exiting. Yes! And building successful software is even more exiting. I have a few ideas for augmenting the experience and excitement of Continuous Integration. The first thing that comes to my mind is the integration of TeamCity with WordPress for automatically publishing important news not just to the engineers, but also to the “general” public. Everybody understands blogs. They are chronological, you can navigate by tags, authors and categories. I coined the term LabPress as the name of this application.

Other CI Server products

TeamCity is of course not the only CI product out there. I am also looking at the following three:

Go

Hudson

CruiseControl.NET

Tags: , , , ,

Tips & Tricks | Testing | Test Automation | Wordpress | LabPress | Continuous Integration

About Klaus Graefensteiner

I like the programming of machines.

Add to Google Reader or Homepage

LinkedIn FacebookTwitter View Klaus Graefensteiner's profile on Technorati
Klaus Graefensteiner

Klaus Graefensteiner
works as Developer In Test and is founder of the PowerShell Unit Testing Framework PSUnit. More...

Open Source Projects

PSUnit is a Unit Testing framwork for PowerShell. It is designed for simplicity and hosted by Codeplex.
BlogShell is The tool for lazy developers who like to automate the composition of blog content during the writing of a blog post. It is hosted by CodePlex.

Administration

About

Powered by:
BlogEngine.Net
Version: 1.6.1.0

License:
Creative Commons License

Copyright:
© Copyright 2014, Klaus Graefensteiner.

Disclaimer:
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Theme design:
This blog theme was designed and is copyrighted 2014 by Klaus Graefensteiner

Rendertime:
Page rendered at 7/22/2014 4:19:57 AM (PST Pacific Standard Time UTC DST -7)