Archive for July, 2006

Castle Monorail + Active Record + Testing + CreateSchemaFromFile

27 July, 2006 Comments off

It’s always a good idea to have your test database match your production database exactly, we can do that easily using:


Unlike CreateSchema which makes a best guess at how your schema should be CreateSchemaFromFile takes an SQL script which allows you to fully control the database schema.

Call CreateSchemaFromFile as part of your PrepareSchema method in your AbstractTestCase class.

protected virtual void PrepareSchema()

Your schema.sql file should contain scripts in the standard MS SQL format:

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Application_Status]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Application_Status]

CREATE TABLE [dbo].[Application_Status] (
[ID] [int] NOT NULL ,
[Title] [varchar] (50) NOT NULL ,
[Description] [text] NULL

Categories: MonoRail

Continuous Integration + CruiseControl.Net + Subversion + MSBuild + .Net 2.0

20 July, 2006 10 comments

I’ve read quite a bit about Continuous Integration and the .Net implementation CruiseControl.Net. It always seemed like a really good idea but I’ve never gotten around to trying it out, until now…

By the way setting up the server was a lot easier than I thought it would be! Here’s what I did:

CruiseControl.Net Setup

Download and run CruiseControl.Net setup

I’ve used version 1.0.1:


NOTE: After setup if your server has .Net 1.1 and 2.0 as mine did you may need to change the ccnet website to use .Net 2.0. This can be done through the IIS control panel, get the properties of the ccnet site and change via the ASP.NET tab.

Subversion Client

Your server will need the subversion console client on the server to allow CruiseControl to checkout your source.

.Net 2 SDK

To allow us to build .Net 2 projects without the need for Visual Studio we need to download and install .Net 2 SDK onto the server

Setup MSBuild

To use MSBuild with CC.Net we need the logger dll -ThoughtWorks.CruiseControl.MsBuild.dll from:

Download and copy to:
C:\Program Files\CruiseControl.NET\webdashboard\bin\

Directory structure

Setup your directory structure:


Using your subversion client checkout source to C:\CI\MyProject\build


Add the project config to ccnet.confg:

 <project name="MyProject">
  <!-- after a change is detected, wait 10 mins and then kick off the build-->
  <schedule type="schedule" sleepSeconds="600" />
  <!--set the sourcecontrol type to subversion and point to the subversion exe-->
  <sourcecontrol type="svn">
   <executable>C:\Program Files\Subversion\bin\svn.exe</executable>
   <!-- Configure MSBuild to compile the updated files -->c:\
    <buildArgs>/noconsolelogger /p:Configuration=Debug</buildArgs>
    <logger>ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program Files\CruiseControl.NET\webdashboard\bin\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
  <!--Publishers will be done after the build has completed-->

CC Tray

You will also want to install the CC Tray monitoring software on your pc:


It will allow you to keep an eye on the server from the comfort of your own pc.

That’s it we’re down!

Categories: General