Archive for the ‘Automated Builds’ 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 :-P – 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!

Upgrading VSTS Beta 3 to RC and Cruise Control

February 16, 2006

Well I was going to do a little introductory post for my first ever post but I figured I may as well put something usefull out there and then do an intro later (if I get time that is….).

Last night I upgraded our install of MS Team Foundation Server from the Beta 3 to the RC, making sure to follow all the instructions carefully. This went really smoothly and everyone seems to be back underway this morning (whew). The only things I came across where:

1) There are two KB packages mentioned in the install doc – these are found on the RC disk if you are wondering where they are.

2) Read http://blogs.msdn.com/vstsue/articles/500334.aspx as stated in the install doc – One thing it mentions is the backup of the encryption key for the reporting services database. I didnt see this anywhere else so if it goes bad it might pay to do this as well.

3) Read Jonesie’s blog as well (http://jonesie.net.nz/TFSRCUpgradeFun.aspx given to me by /\ndrew at http://andrewpeters.wordpress.com/). He mentions hitting the registaration service. I’m not sure if this was fixed with the patched installer but I did it anyway and the upgrade worked so why not a :-) Also, the re-install of the team explorer client is another thing to note.

4) Make sure you also do the install under a domain account – not just logged in as the admin on the box. I think with the beta 3 it told you to but you could get away with it … can’t remember now but that’s something to watch out for – If you forget then just login and restart the install ;-)

Apart from that it all just seemed to work. The cool things I did find out though were:

1) You can delete TFS projects using TFSDeleteProject.exe found under C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ . We found that people wanted to play with the first install of the TFS box but once the root node was in there we couldnt really get rid of it (didnt know how to completelly delete it). I’m not sure if we just didnt spot a gui option from vs but this little guy works when run from the server or a client machine :-) The annoying thing is that if the creation of the project fails the root node can end up in there but then the delete won’t seem to work! Arrhhh – I’m not sure if you can try the creation again with the same name or if it just kind of gets stuck …. something I’ll have to look into

2) If you are using cruise control with the vsts plugin (http://vstsplugins.sourceforge.net/) then this will need to be recompiled. Grab the source and do a rebuild – it will fall over but (as a dirty hack to get our box running again) I commented out the line:

teamFoundationServer = TeamFoundationServerFactory.GetServer(this.Server, this.Credentials);

that it fails on and replaced it with the line:

teamFoundationServer = TeamFoundationServerFactory.GetServer(this.Server);

I spent like less than 5 minutes on it but I patched the dlls up onto the server and cruisecontrol is up and running again (copied all the ccnet ones and the vsts plugin dll as well). This is probibly not the best but I just wanted to get it working again – Hopefully someone might find it usefull until the actual vsts plugin dll gets recompiled on the official download site :-) (I’ll try and post the dll’s up soon if someone just wants to download them – Hopefully it will work just as well for you as it did for me – Just having some upload issues at the mo)


Follow

Get every new post delivered to your Inbox.