Click here to Skip to main content
Click here to Skip to main content

Automate Builds using SVN, MSBuild, Cruise Control

, 5 Apr 2010
Rate this:
Please Sign up or sign in to vote.
This tutorial explains how to automate the build with the help of SVN, MSBuild and Cruise control

Introduction

This article will explain how to use SVN, MSBuild, Cruise control and CCtray to automate the build process.

msbuild.xml

msbuild document is used to build the .NET solution file. Below is the snapshot of the msbuild document.

It starts with tag Project and we must have to import the msbuild path installed on our local system.

There are Target tags (can be more than one) and we can give them any name. The compiler will search for the tag Build and starts with that tag. Before that, it will go through the tags specified in DependsOnTarget.

1.JPG

Code Snap of msbuild.xml

Below is the code snippet displayed in the image to copy in your application.

<Project DefaultTargets="Build" 
	xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    
    <Import Project=
      "C:\Program Files\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>

    <Target Name="GetSource">
            <Message Text="Checking out trunk into $(SourceDirectory)" />
            <SvnCheckout RepositoryPath="PATH TO SVN" 
                LocalPath="LOCAL PATH TO FOLDER"
                UserName="USERNAME OF SVN"
                Password="PASSWORD OF SVN">
                <Output TaskParameter="Revision" PropertyName="Revision" />
            </SvnCheckout>
            <Message Text="Have got revision: $(Revision)"/>
        </Target>

    <Target Name="Build" DependsOnTargets="GetSource;Clean;" />
    
    <Target Name="Clean">
        <!-- Clean, then rebuild entire solution -->
        <MSBuild Projects="D:\Projects\SOLUTIONFILENAME.sln" Targets="Clean;Rebuild" /> 
    </Target>

</Project>

Configure Cruise Control

Now go to “C:\Program Files\CruiseControl.NET\server” and open “ ccnet.config

2.JPG

<cruisecontrol>
<project name="YOURPROJECTNAME">
         <webURL>http://SERVERIPADDRESS/ccnet/</webURL>

        <triggers>
            <intervalTrigger seconds="14400" buildCondition="ForceBuild" />
        </triggers>

        <tasks>
            <msbuild>
                <executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
		</executable>
                <workingDirectory>PATH OF WORKING DIRECTORY</workingDirectory>        
                                <buildArgs>MSBUILDFILENAME.msbuild 
				/p:Configuration=Debug</buildArgs>
                <timeout>1800</timeout>
                <!--  30 minutes -->
                <logger>C:\Program Files\CruiseControl.NET\server\
			ThoughtWorks.CruiseControl.MSBuild.dll</logger>
            </msbuild>
        </tasks>
    </project>
    
</cruisecontrol>   

Now, configure the cc tray by passing the SERVERIPADDRESS as above XML document and click on build. If build is successful, then it will show a green symbol otherwise it will show a red symbol.

Configure CCTray

Step 1

go to File - >Settings

3.JPG

Step 2

Then in Build project tab, click on Add button.

4.JPG

Step 3

After that, click on Add Server button.

5.JPG

Step 4

Then in URL part, type the IP address of the server or localhost on which the ccnet is installed.

6.JPG

Step 5

When server is added, all the projects added in the configuration file will be displayed on the right side panel. Click on project to add in cctray.

7.JPG

In the next tutorial, I will discuss how to send email through ccnet and how to configure the web dashboard of ccnet.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Jitendra Zaa
Software Developer (Senior) GlobalLogic
India India
From a Nagpur City of Maharashtra currently working as Sr. Software Engineer at GlobalLogic India pvt. Limited.
He has nearly 3 years experience and worked in many technologies like JAVA, PHP, JSP, Struts, Hibernate.
Currently working on .Net technology with C#, ASP and telerik controls.
Also has experience in cloud computing including salesforce.com.
you can reach him at ilovenagpur@gmail.com
Blog:http://www.shivasoft.in/blog

Comments and Discussions

 
GeneralMy vote of 5 PinmemberMember 17850917-Nov-12 0:48 
QuestionNice PinmemberLaserson31-Jul-12 23:47 
GeneralMy vote of 5 PinmemberEric.Ren Shiyi24-Mar-11 3:11 
GeneralLet CruiseControl.NET handle the source code PinmemberJens Buchta6-Apr-10 0:51 
GeneralRe: Let CruiseControl.NET handle the source code PinmemberJitendra Zaa6-Apr-10 1:35 
Questionyou do know that you username, password and web addresses are completely readable ? Pinmembergpgemini3-Apr-10 19:43 
..
AnswerRe: you do know that you username, password and web addresses are completely readable ? Pinmemberstano4-Apr-10 2:59 
AnswerRe: you do know that you username, password and web addresses are completely readable ? PinmemberJitendra Zaa4-Apr-10 21:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 6 Apr 2010
Article Copyright 2010 by Jitendra Zaa
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid