The commonly used tools in the continuous integration process are:
- CruiseControl.Net [ Version: 1.5.0.6268]
- Visual SVN Server [Version: 2.0.7]
- MSBuild
- Microsoft FXCop [Version: 1.36]
- SourceMonitor [Version: 2.5.1.0]
CruiseControl .Net
CruiseControl.Net is an automated integration server that automates the integration process by monitoring the development team’s source control repository directly.
Visual SVN Server
Visual SVN Server can be used as the subversion repository.
MSBuild
MSBuild is a Microsoft build platform for Asp.Net projects which can be used to build our solutions in the continuous integration process.
Microsoft FXCop
MS FxCop is a tool used to check whether the code follows the custom guidelines designed by the developer for writing robust and maintainable code by using .Net framework.
SourceMonitor
SourceMonitor is a freeware, used to find out the extend/number of codes included in the solution and also to find the complexity of modules.
Implementation
1. Installation
Before starting the implementation, setup two servers exclusively for the continuous integration process – a Continuous Integration Server and an Integrated Testing Server.
The Continuous Integration Server contains the above tools used for the integration process. The Integrated testing server is used to store the published source code after the integration process.
In the C.I process, the first step is the installation of CruiseControl.Net. With the installation of CruiseControl.Net, a virtual directory named “ccnet” will be created in the machine’s IIS webserver or this can be done by pointing a virtual directory to the “webdashboard” folder of the installed files.
Install all the tools mentioned above in the Continuous Integration server. MsBuild is a tool which is available with the installation of .Net framework.
2. Configuration Files Setup
While running, the CruiseControl.Net will search for file named ccnet.config which is an XML file. So all the information needed by ccnet to access, what it is supposed to do and how it is supposed to do must be placed in the ccnet.config file.
ccnet.config file contains a root element <cruisecontrol> and a child element <project>. So configuration settings for each project are included in their corresponding <project> tag.
<cruisecontrol>
<project name=" SampleProject” >
</project>
</cruisecontrol>
Each project contains some child tags. They are explained below.
<workingDirectory></workingDirectory>
<artifactDirectory></artifactDirectory>
- <workingDirectory> contains the checked out version of the project under integration.
- <artifactDirectory> is meant to save the results of build such as build logs.
Security
The security tag is used to protect the system from unauthorized access and to provide permission to authorized users.
<security type="defaultProjectSecurity" defaultRight="Deny">
<permissions>
<rolePermission name="SampleProjectAdmin" ref="SampleProjectAdmin" />
</permissions>
</security>
<internalSecurity>
<users>
<passwordUser name="User1" password="12345"/>
</users>
<permissions>
<rolePermission name="SampleProjectAdmin" forceBuild="Allow" viewProject="Allow" startProject="Allow" viewConfiguration="Deny" viewSecurity="Deny">
<users>
<userName name="User1"/>
</users>
</rolePermission>
</permissions>
</internalSecurity>
In the above security settings, this will restrict permission for SampleProjectAdmin user group according to the authentication defined in the <rolePermission> tag.
Subversion Source Control Block
CruiseControl.Net provides basic support for subversion. It can check for changes, can be used for updating sources and can also automatically check out for source.
<sourcecontrol type="svn">
<executable>C:\Program Files\VisualSVN Server\bin\svn.exe</executable>
<trunkUrl>
https://server/svn/SampleProject
</trunkUrl>
<workingDirectory>
C:\ProjectWorkingDirectories\SampleProject
</workingDirectory>
<username>
username
</username>
<password>
password
</password>
</sourcecontrol>
- <trunkUrl> is the url of the repository for the project.
- <workingDirectory> is the locally checked out path for the project.
- <executable> is the location of the SVN executable.
- <username> is the username for authentication when connecting to repository.
- <password> is the password for authentication when connecting to repository.
Trigger Block
A trigger block is used to instruct the cruise control .net to perform the integration process periodically after a specified interval of time.
<triggers>
<intervalTrigger name="Subversion" seconds="1800" />
</triggers>
Task Block
Tasks declared in the task block will be executed for each trigger. Here MsBuild can be used for building our project.
<tasks>
<msbuild>
<executable>
C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe
</executable>
<workingDirectory>
C:\ProjectWorkingDirectories\SampleProject
</workingDirectory>
<projectFile> SampleProject.sln</projectFile>
<buildArgs>
/noconsolelogger
/p:Configuration=Debug
</buildArgs>
<targets>Build</targets>
<timeout>900</timeout>
<logger>
C:\ProgramFiles\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll
</logger>
</msbuild>
</tasks>
- <executable> is the location of MSBuild.exe.
- <workingDirectory> is the directory containing our project source.
- <projectFile> is the name of the project to run which is relative to working directory.
- <buildArgs> is the extra arguments that pass to MSBuild command.
- <timeout> is the number of seconds to wait before assuming that the process has hung and should be killed.
Another MsBuild task can be used to publish the build source code. The second MsBuild uses another config file which publishes the build code to a folder in the integrated testing server. We use AspNetCompiler task to precompile our applications.
The second config file contains:
<Project xmlns = "http://schemas.microsoft.com/developer/msbuild/2003"
name = "AspNetPreCompile"
DefaultTargets = "PrecompileWeb">
<Target Name = "PrecompileWeb">
<AspNetCompiler
VirtualPath = "DeployTemp"
PhysicalPath = "C:\ProjectWorkingDirectories\ SampleProject”
TargetPath =”\\IntegratedTestingServer\SampleProject”
Force = "true"
Debug = "true"
Updateable = "true"/>
</Target>
</Project>
It publishes the build code in the working directory to the integrated testing server. So in the second MSBuild the <projectFile> points to this new config file.
Executable Task
CCNet gives the opportunity to integrate any tool in the executable task. By integrating such tools we can generate more useful build results.
<tasks>
<exec>
<executable> </executable>
<baseDirectory> </baseDirectory>
<buildArgs> </buildArgs>
<buildTimeoutSeconds> </buildTimeoutSeconds>
</exec>
</tasks>
- <executable> is the path of the program to run.
- <baseDirectory> is the directory to run the program.
- <buildArgs> contains any command line arguments to pass while running the program.
- <buildTimeoutSeconds> is the number of seconds to wait before assuming that the process has hung and should be killed.
By using this executable task, Microsoft FXCop and SourceMonitor can be integrated to check the coding standards and to find the complexity of modules in our code.
We can integrate any new process to ccnet by using the <executable> task.
For example: Here we have integrated a web.config editor to change the debug mode to release mode.
<exec>
<executable>SampleProject\WebConfigEditor.bat</executable>
</exec>
During each trigger, this batch file will execute and change the debug mode in the web.config to release mode before publishing the project into the integration testing server.
Publisher Block
The publisher block is used to merge the build reports.
<publishers>
<merge>
<files>
<file> </file>
</files>
</merge>
<xmllogger logDir="buildlogs" />
<statistics />
<modificationHistory />
</publishers>
- <file> contains the path of the reports that has to be shown in the dashboard.
- <xmllogger> is used to create the log files used by cruise control .net dashboard. logDir is the directory used to save log files. The path is relative to Artifact directory.
By setting the above config files, a sample project named Sampleproject can be displayed in the dashboard of ccnet. By forcing the project, it will build and publish to the integration testing server.
Sample screen shot for the dashboard of ccnet appears as given below.
No related links found




