Archive for the ‘Cruise Control’ Category

Subversion + .Net

July 21, 2006

I set up Subversion + continous integration (Cruisecontrol.Net) + testing (NUnit) + code analysis (NCover.Net) + VS2005 Subversion IDE integration on the weekend. Seems to be running pretty sweet. Why? Well its free – because I can 😛 – and its good to practise this stuff + I find on my little pet projects I seem to edit files and then sometimes need to rollback – now with some source control I can get back to where I was yesterday 🙂

I like the subversion model for editing files in a disconnected mode – makes it really good for working on stuff, when your out and about on some random machine, that may be offline for a while. Anyway, here’s all the bits that I used:

A 1 click subversion and subversion client setup: http://svn1clicksetup.tigris.org/

or alternativelly: The main Subversion page: http://subversion.tigris.org/ , and the TortoiseSVN install (subversion client): http://tortoisesvn.tigris.org/

Cruisecontrol.Net: http://sourceforge.net/projects/ccnet/

NCover.Net: http://ncover.org/site/

NUnit: http://www.nunit.org/

NAnt: http://nant.sourceforge.net/

Subversion VS IDE package: http://ankhsvn.tigris.org/ (this has a merge tool but maybe TortoiseMerge might be better – I havent checked it out…)

To get it all running I used the following in my ccnet server config (a snippet of the file):

<sourcecontrol type=”svn”>
   <executable>F:\Program Files\Subversion\bin\svn.exe</executable>
   <trunkUrl>svn://ghost64/TestProject/trunk/</trunkUrl>
   <workingDirectory>F:\Program Files\CruiseControl.NET\server

\TestProject\WorkingDirectory</workingDirectory>
   <username>ccnetbuild</username>
   <password>*****</password>
   <autoGetSource>true</autoGetSource>
  </sourcecontrol>
  
  <tasks>
   <exec>
    <executable>F:\Program Files\Subversion\bin\svn.exe</executable>
    <baseDirectory>F:\Program Files\CruiseControl.NET\server

\TestProject\WorkingDirectory</baseDirectory>
    <buildArgs>checkout svn://ghost64/TestProject/trunk/ TestProject–username ccnetbuild –password *****</buildArgs>
    <buildTimeoutSeconds>100</buildTimeoutSeconds>
   </exec>
   <nant>
    <executable>F:\Program Files\nant\bin\nant.exe</executable>
    <baseDirectory>F:\Program Files\CruiseControl.NET\server\TestProject\

WorkingDirectory\TestProject\TestProject</baseDirectory>
    <buildFile>default.build</buildFile>
   </nant>
   <merge>
    <files>
     <file>F:\Program Files\CruiseControl.NET\server\TestProject\WorkingDirectory

\TestProject\TestProject\TestLibrary\bin\Debug\TestResult.xml</file>
     <file>F:\Program Files\CruiseControl.NET\server\TestProject\WorkingDirectory

\TestProject\TestProject\Coverage.Xml</file>
    </files>
   </merge>
  </tasks>

I found I needed a task to pull the source and build it – the main source block didn’t seem to want to do it… I don’t know what that was about… anyway I just put in a task to get a working set and away it went. After that I had the main nant build task (where the build, tests, and coverage where run) and finally I merged all the results in :-). I edited the main environment path variable to include the paths to the nunit and ncover executables and then I could run the following from my nant file (actually this was in a batch file the nant script called out too – note TestLibrary was the name of the test project in the solution):

ncover.console nunit-console TestLibrary.dll //w .\TestLibrary\bin\Debug

By wrapping ncover around the nunit tests it has something to run against… you cant just run it against a raw dll – it needs something to be running the code – this way nunit will exectue the code so you can cover a dll.

Anyway, overall it seems to be running really well 🙂 Check it out some time!