Rash thoughts about .NET, C#, F# and Dynamics NAV.


"Every solution will only lead to new problems."

Thursday, 8. January 2009


How I do Continuous Integration with my C# / F# projects – part I: Setting up Source Control

Filed under: C#,English posts,F#,Tools,Visual Studio — Steffen Forkmann at 14:31 Uhr

In this post series I will show how one can easily set up a Continuous Integration scenario for F# or C# projects with completely free products.

“Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily – leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible.”

[Martin Fowler]

The first step for Continuous Integration is to set up a Source Control environment. For many good reasons I choose Subversion – some of them are:

  • Atomic commits
  • Rename/Move/Copy actions preserve the revision history
  • Directories are versioned
  • Multiple repository access protocols including HTTP and HTTPS
  • There is a nice Visual Studio integration (see below)
  • Last but not least: it is completely free 🙂
Source code version control with Subversion

All you need for setting up a complete Subversion environment is to download and install VisualSVN Server from http://www.visualsvn.com/.

“VisualSVN Server is a package that contains everything you need to install, configure and manage Subversion server for your team on Windows platform. It includes Subversion, Apache and a management console.”

[product homepage]

Now you can create user accounts and a repository ”CITest” in the VisualSVN Server management console.

Create a repository

VisualSVN Server management console

Subversion integration in Visual Studio 2008

Download and install AnkhSVN 2.0.x from http://ankhsvn.open.collab.net/.

“AnkhSVN is a Subversion SourceControl Provider for Visual Studio. The software allows you to perform the most common version control operations directly from inside the Microsoft Visual Studio IDE. With AnkhSVN you no longer need to leave your IDE to perform tasks like viewing the status of your source code, updating your Subversion working copy and committing changes. You can even browse your repository and you can plug-in your favorite diff tool.”

[product homepage]

Now you can add your C#/F#-solution to your CITest-repository:

  • Open the solution in Visual Studio 2008
  • Open “View/Repository Explorer” and add your repository to AnkhSVN
    • You can copy the URL from the VisualSVN Server management console (In my case this is https://omega:8443/svn/CITest/)
    • You also have to give AnkhSVN your Subversion login
  • Now click the right mouse button on your solution in the Solution Explorer and choose “Add Solution to Subversion”

Add Solution to Subversion

Don't forget to specify a Log Message

Now we can modify our solution and commit our changes via “Commit solution changes” in the Solution Explorer:

Commit Solution Changes

We can easily control our changes via AnkhSVN’s “Repository Explorer” and “History Viewer” in Visual Studio 2008:

Repository Explorer and History Viewer

If we do any changes in the Program.fs file, we can see a diff via the “Show changes” functionality:

Diff with AnkhSVN

If you don’t like the default Diff tool you might try WinMerge.

Next time I will show how to set up a Continuous Integration server.

Tags: , , , , , , ,