DOTNET development – automatic builds and tests

1. General remarks

Most of the successfull open source projects are using some elementary tools which have influence to the way the developer is working. If several team members have a common goal


it is important that the project resources are managed in a save and easy way. Usually all relevant files should be checked in to a revision control system like Mercurial, Git, Subversion, CVS etc. This implies that everything that is needed to build the project is also under revision control.

To be able to handle merge conflicts easily, tools like Winmerge are a great help. BUT tools like Winmerge are only effective if the files they are comparing are text files with a structure that show differences line by line when comparing different versions.

Build tools like NANT have xml like files to control all the build processes, why NANT fits very good in this concept.

To allow new developers to start developing without fear to produce some hidden errors in the project, unit tests (thank you Kent Beck) give the necessary security. If after a change all tests still pass everything should be fine. This implies on the other hand that all code parts are tested in some test cases.

Log4Net Logging framework is well suited to add logging command to the code with the possibility to configure the output with respect to log levels per class.

Let’s put all the parts together ….

2. Requirements / Preconditions

Most important: Get a cup of coffee first! cup_of_coffee

  • DOTNET Framework
  • NAnt
  • Nunit
  • NUnit2Report
  • MySQL DOTNET Connector
  • Log4Net

3. The complete working example

As a start point for your own project you may download a complete example project with a simple unit test case which tests a simple count of a mysql database table.


To compile, build and test the project with test report generation afterwards use the command from the commandline in the project directory:

The generated unit test report is realized using frames and allows flexibel browsing in the test results.


Other NAnt targets defined in the example project are build, test, run.

4. Links / References

[1] Microsoft DOTNET Framework
[2] NAnt
[3] Log4net
[3] NUnit
[5] NDoc
[3] NUnit2Report