To keep your code clean and in a compiled form we need to keep track that no erroneous file get checked-in to your code repository. The best way to perform this is to use an autobulid process when a new checkin in repository happens. Recently I tried to perform the same and so came to write about the quick steps -
First of all you need tools that can perform these auto task for you. I recommend CruiseControl .net tool for this. Its free and open source.
If you’re using SVN subversion control then its required a svn client to get the latest source code and checkin detection.
I prefer Collabnet subversion client.
Download Cruise Control and Install it with easy next –> next –> finish steps. It’ll ask you to create an IIS website so make sure you’ve IIS installed. The website will be your dashboard to check your build status and reports.
Once you done with installation go to the directory where you installed the tool. Default path for this is -
For (64 bit) -
C:\Program Files (x86)\CruiseControl.NET
For (x86) -
Now go to the “server” sub directory on the above location and you’ll find the ccnet.config file. Open this file in your favourite XML editor (mine is NotePad++). In case you’re using Notepad++ don’t forget to select the language from the menu choose XML.
Edit your ccnet.config file with your project, svn and other details like below sample -
<project name="Code library - 1.0 - Local">
<!--Mention you name of project directory location here -->
<!--for reports and logs-->
<!--Url for the web dashboard of cruise control-->
<!-- Give trigger sepcification when the build should kick off -->
<intervalTrigger name="continuous" seconds="300" buildCondition="IfModificationExists" />
<!-- Incremental label for your each build-->
<!-- configure your svn details-->
<executable>C:\Program Files (x86)\CollabNet\Subversion Server\svn.exe</executable>
<!-- setting up tasks for build your project-->
<buildArgs>/noconsolelogger /p:Configuration=Release /p:Platform="Any CPU" /v:diag </buildArgs>
<!-- Make sure to change the path based on your platform architecture (x86) or 64-->
<logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
<!-- This is something you would only required if you want to merge multiple generated reports into one for e.g. your unit test reports-->
once you done editing save it and close.
Now open file -
C:\Program Files (x86)\CruiseControl.NET\webdashboard\dashboard.config
Add the above mentioned XSL files. These templates are already installed with your CruiseControl tool.
Now you’re almost done with configuration.
Go to services and start CruiseControlServer
Once the service started it’ll start watching your project for latest checkins. If service is not starting then there’s a problem in your configuration XML. Double check it.
Now open the url http://localhost/ccnet make sure its showing you cruise control dashboard and you project name is visible there.
And you’re done . Now download the CCTray from above dashboard and add project as HTTP url(i.e. http://localhost/ccnet) from add server setting. if its connected it’ll show you the project and its state with color coding ‘Green’ (Means everything is ok).
Now checkin a code file in your project and watch it building from CCTray. If its successful you can do something like -
1. web dashboard is not showing my project
Make sure you’ve placed your ccnet.config in the server directory and its updated with your project info. and Cruise control services are running.
2. error – Your svn copy is too old to work with the subversion svn client.
Try to download earlier version of collabnet subversion svn client and restart the service again. Futher if it can give error – Your svn subversion is tool old to work with your svn repository. Now you can install your previous collabnet subversion client and it should work.
3. MSbuild task failed -
Make sure your arguments and project directory information is correctly mentioned in ccnet.config file. Try to run the MSbuild command argument in vs command prompt if it works fine there then it will definitely work here.