Microsoft .NET - Tips and Tricks



Tuesday, March 20, 2007
Configuring CruiseControl .Net to work with multiple Subversion repositories
What is this article about?

CruiseControl.NET (CCNet) is an Automated Continuous Integration server, implemented using the Microsoft .NET Framework. This article will not explain what continuous integration is and how CruiseControl .Net works and will assume that readers already have a basic knowledge of the system. In this article I’ll write about how CruiseControl .Net should be configured in order to work with Subversion when more subversion providers should be used.

Prerequisites

Next list shows the software that should be installed on machine running CruiseControl .Net server:
     1. FxCop version 1.35 should be installed on machine.
     2. NUnit version 2.2.8 or later should be installed on machine.
     3. NCover and NCoverExplorer should be installed on machine.
     4. SVN (svn-win32-1.4.3) should be installed on machine and access to Subversion from that machine must be enabled

Configuring CruiseControl .Net

This example will show you how to configure CCNet for solution consisting of projects hosted on different repositories.

The first thing you should do is to create a msbuild configuration and file structure on local file system that will hold the temporary files and results of build.

After you have all the folders and files ready (msbuild, fxcop, ndpend, etc) you should edit your ccnet.config file and follow next steps:
1. Under <cruisecontrol> section add new <project> section like this:
     <cruisecontrol>
          <project name="PrjName" workingdirectory="C:\CCNet\PrjName\">
          </project>
     </cruisecontrol>

2. Replace PrjName with the name of your project and set the correct path to the folder where your configuration files are located.

3. Under <project> tag add a sourcecontrol tag with attribute type set to multi:
     <sourcecontrol type="multi">
     </sourcecontrol>

4. Now add a sourceControls tag with autoGetSource attribute set to true:
     <sourcecontrols autogetsource="true">
     </sourcecontrols>

5. For each of the projects located on different subversions add a new svn section like this:
     <svn>
          <executable>c:\program files\svn-win32-1.4.3\bin\svn.exe</executable>
          <trunkurl>svn://server/trunk/folder1/prj1/</trunkurl>
          <tagonsuccess>false</tagonsuccess>
          <username>username</username>
          <password>password</password>
          <workingdirectory>C:\CCNet\PrjName\Code\folder1\prj1</workingdirectory>
          <autogetsource>true</autogetsource>
     </svn>

6. Set “trunkUrl”, “username”, “password” and “workingDirectory” parameters to right values.

7. Add <tasks>, <publishers> and <triggers> sections to your ccnet.config file and save the file.


The whole configuration file should now look like this:

<cruisecontrol>
  <project name="PrjName" workingdirectory="C:\CCNet\PrjName\">
    <sourcecontrol type="multi">
      <sourcecontrols autogetsource="true">
        <svn>
          <executable>c:\program files\svn-win32-1.4.3\bin\svn.exe</executable>
          <trunkurl>svn://server/trunk/folder1/prj1/</trunkurl>
          <tagonsuccess>false</tagonsuccess>
          <username>username</username>
          <password>password</password>
          <workingdirectory>C:\CCNet\PrjName\Code\folder1\prj1\</workingdirectory>
          <autogetsource>true</autogetsource>
        </svn>
        <svn>
          <executable>c:\program files\svn-win32-1.4.3\bin\svn.exe</executable>
          <trunkurl>svn://server/trunk/folder1/prj1/</trunkurl>
          <tagonsuccess>false</tagonsuccess>
          <username>username</username>
          <password>password</password>
          <workingdirectory>C:\CCNet\PrjName\Code\folder1\prj1\</workingdirectory>
          <autogetsource>true</autogetsource>
        </svn>
        <svn>
          <executable>c:\program files\svn-win32-1.4.3\bin\svn.exe</executable>
          <trunkurl>svn://server/trunk/folder1/prj1/</trunkurl>
          <tagonsuccess>false</tagonsuccess>
          <username>username</username>
          <password>password</password>
          <workingdirectory>C:\CCNet\PrjName\Code\folder1\prj1\</workingdirectory>
          <autogetsource>true</autogetsource>
        </svn>
        <svn>
          <executable>c:\program files\svn-win32-1.4.3\bin\svn.exe</executable>
          <trunkurl>svn://server/trunk/folder1/prj1/</trunkurl>
          <tagonsuccess>false</tagonsuccess>
          <username>username</username>
          <password>password</password>
          <workingdirectory>C:\CCNet\PrjName\Code\folder1\prj1\</workingdirectory>
          <autogetsource>true</autogetsource>
        </svn>
      </sourcecontrols>
    </sourcecontrol>
    <tasks>
      <msbuild>
        <executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable>
        <projectfile>PrjName.msbuild</projectfile>
        <buildargs>/noconsolelogger /p:Configuration=Debug</buildargs>
        <targets>BuildAll</targets>
        <timeout>400</timeout>
        <logger>C:\Program Files\CruiseControl.NET\webdashboard\bin\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
      </msbuild>
    </tasks>
    <publishers>
      <merge>
        <files>
          <file>nunit-results.xml</file>
          <file>Coverage.xml</file>
          <file>CoverageReport.xsl</file>
          <file>PrjName.FxCop.xml</file>
          <file>NDependOut\ApplicationMetrics.xml</file>
          <file>NDependOut\AssembliesBuildOrder.xml</file>
          <file>NDependOut\AssembliesDependencies.xml</file>
          <file>NDependOut\AssembliesMetrics.xml</file>
          <file>NDependOut\InfoWarnings.xml</file>
          <file>NDependOut\NDependMain.xml</file>
          <file>NDependOut\TypesDependencies.xml</file>
          <file>NDependOut\TypesMetrics.xml</file>
        </files>
      </merge>
      <xmllogger>
      </publishers>
    <triggers>
      <!-- Check for modifications each 30 minutes -->
      <intervaltrigger seconds="1800" buildcondition="IfModificationExists">
      </triggers>
  </project>
</cruisecontrol>

For all the problems you might have check the ccnet.log file in CCNet\server folder.

posted by Popovic Sasa
+ Read comments 2 comments
 

 

Links

Get the Levi9 RSS Feed
Levi9 Global Sourcing

Previous Posts

Web Parts generator tool
Unit testing internal units/methods - Friend Assem...
Signing a 3rd party DLL
Custom paging SPGridView control
Serving files from server
Configuring CruiseControl .Net to work with multip...
Sharing cookies between sub-domains

Archives

February 2007
March 2007
April 2007
January 2008
February 2008
Current Posts

Powered by Blogger
Levi9 Global Sourcing | Jan van Goyenkade 8 | 1075 HP Amsterdam | The Netherlands | +31(0)72 58 210 55 | info@levi9.com
Copyright © Levi 9 | Design by A36