It’s about programming

November 7, 2006

How To Set Up CI System Using CruiseControl.NET For .NET Projects

Filed under: Continues Integration — Lakmal @ 11:17 am

CruiseControl.NET is a tool developed by ThoughWroks for support Continues Integration in .NET Application development projects. It can be considered as .net version of famous CI CruiseControl tool which is used in java application development. So i would like to continue this discussion regarding basic three phase of CI process.

1) Source Version Control System Monotoring for chaneges

2) CheckOut the source, Build and run the test cases on the built source

3) Publish the build status to the developers and other responsible people

Those are the phases i consisdered while setting up CI System for our project. As prerequirements First you have download and install tfollowing Sowftware to your build mashine before setting up a CI system.

1) Download and install Source Version Control Application. In my case i downloaded and installed Subverion 1.3 version

2) Download and install CruiseControl.NET from the ThoughtWorks Web Site. In my case i used CruiseControl.NET-1.1.– http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET

3) Download and install .NET Framework and SDK. Here MSBuild is available with .NET SDK
Monitrong Source Control System


Here we are using Subversion as our source control system and we have to specify it to CruiseControl.NET to tool in ccnet.config file. (Here ccnet.config file you can find from the <CruiseControlInstallationFolder>\server Folder and it is the file refer by CruiseControl.NET server to find out project it’s controling.) . It’s better to consider about ccnet.config file structure first..

<CruiseControl>

<Project>

<sourcecontrol>

This is the tag we have to use to specify configuration for Monitoring Central Source changes </sourcecontrol>

<tasks>

Here we can have several actions to be taken after centra source changes

</tasks>

<publishers>

Here we can specify several publication methods for the CI process. For Example send email, write Xml log files and etc.

</publishers>
</Project>

</CruiseControl>

Here we can have more than one project controlling under CruiseControl.NET server and In project tags we have to specify Project properties which will be usefull to CCNET.

<Project>

<WorkDirectory>Your Source Directory</WorkDirectory>

<ArtifactDirectory>Your log info directory</ArtifactDirectory>

<Catagory>Your Project Name </Catagory>

<WebUrl> Web Url which will be used to publish project status</WebUrl>

<modificationDelaySeconds>Number of seconds delay after a modification before doing anything </modificationDelaySeconds>

<SourceControl>

<trunkUrl>Central Source Url (http://172.20.1.24:81/svn/P51_TEMPUS_REPORTS/trunk/src)</trunkUrl>

<workingDirectory>This is your sour directory which will synchronize with Source Control server </workingDirectory>

<executable>SVN Executavle File Path(For a Example C:\Program Files\Subversion\bin\svn.exe)</executable>

<–! Specify here whether download ot not after the change happened in the Central Source Code –>
<autoGetSource>true</autoGetSource>

</SourceControl>

<–! If Ang change happen on Central source we may want to have several kind of actions on it such as checkout and build the source and etc. So the following <Task> tab is used to specify kind of action should be taken after any change happen –>

<tasks>

<msbuild>

<executable>MSBuild Executable Path (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild.exe)</executable>

<projectFile>project file path which is refered by MSBuild to build the project. In my case I used our solution file and you can any project files like .vbproj or csproj. But it is nor allowed to use .proj file here (D:\WorkDir\P51_Tempus_Reports\src\ProjectHourReporting.sln)</projectFile>

<buildArgs>Specify Build arguments like debugging info setting and etc (/noconsolelogger /p:Configuration=debug /v:n)</buildArgs>

<timeout>Time out period(10000000)</timeout>

<workingDirectory>Source Directory (D:\WorkDir\P51_Tempus_Reports\src)</workingDirectory>

<logger>Loging Configuration (ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll)</logger>

</msbuid>

<Task>

<–! Here We may have more than one task. But in my case i used only one task which for buid the project –>

<–! Another Main phase Of a CI process is Publishing Build Action Status. In this case we can have several kind of pushing methods like Email publishing, Build publishing or Writing XMl Log files. In my case i used XMLLogger and email as publishers –>

<Publishers>

<xmllogger logDir=Xml log file directory(“D:\WorkDir\P51_Tempus_Reports\output\buildlogs”) />

<–! following email tag will configure email publishing process–>

<email from=”lakmalk@eurocenter.lk” mailhost=”172.20.1.11″ includeDetails=”TRUE”>
<users>
<user name=”Hasith” group=”BuildFailed” address=”hasithy@eurocenter.lk”/>
<user name=”Lakmal” group=”Changed” address=”lakmalk@eurocenter.lk”/>
<user name=”Uchitha” group=”BuildFailed” address=”uchithar@eurocenter.lk”/>
<user name=”Samudra” group=”BuildFailed” address=”samudrap@eurocenter.lk”/>
<user name=”Shamila” group=”BuildFailed” address=”shamilap@eurocenter.lk”/>
<user name=”Saminda” group=”BuildFailed” address=”samindaw@eurocenter.lk”/>
</users>
<groups>
<group name=”Changed” notification=”always”/>

<group name=”BuildFailed” notification=”failed”/>
</groups>
</email>

</Publishers>

This is the Essential of what i did to acheive Continues Integration In our project…

Continues Integration – http://martinfowler.com/articles/continuousIntegration.html
http://martinfowler.com/articles/originalContinuousIntegration.html

Cruise Control -

Regards

Lakmal

1 Comment »

  1. Nice Article Thanks Lakmal

    Comment by Ricky — December 9, 2006 @ 2:11 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.