RambleJam

My little rambles in cyberspace …

Entries Comments


DMon - Multi Directory Viewer

25 November, 2009 (13:57) | Computing | No comments

I have just released a new utility application that lets the user monitoring many directory locations in a single view.  If you have ever found yourself in a situation where you have many Windows Explorer instances open watching different directory locations this should make that task a lot easier.

In the current version you can also configure DMon to produce a log file containing all the different actions that were performed on the directories being monitored.  Below is a screen shot of the app and links to more information and the download links.

Read More & Download

DMon screen shot

MSBuild, TeamCity & Versioning

1 November, 2009 (20:25) | .NET / C#, Computing, Continuous Integration | No comments

I have only recently start using TeamCity at home for my own major project SampleSort.  It is a pretty complex application all in all and the build process is also complex due to the modular nature of its internal structure.  Now this is all controlled by TeamCity it makes proper versioning a real proposition rather than incrementing a version number by hand.  Even though it is possible to version assemblies using the 1.0.* pattern in the version attributes in the AssemblyInfo.cs file this isn’t the best solution for my particular scenario.

Now if you are using source control it is useful to have the version number of the source incorporated into the overall application version.

Using TeamCity I have manually set the Major and Minor so that I have some control over it but the build number comes from TeamCity and the revision is taken from my Subversion repository.  To do this you need to use a pattern like this in the ‘Build Number Format’ setting on the General Settings page of your build configuration:

0.6.{0}.{build.vcs.number}

The 0.6 section is the portion I retain control over, the {0} is filled in by TeamCity an the {build.vcs.number} is the Subversion repository number.

Now to make use of this in the build process you need to access this information and update the AssemblyInfo.cs files BEFORE the build system performs the Release build. I looked at the community tasks for the AssemblyInfoTask but was a little put off.  For one thing it creates the file rather than edits the existing one, which is a 20+ project scenario would result in a fairly hefty build script.  All I wanted to so was update the existing AssemblyInfo files.  So, my MSBuild target is as follows:

So here we are using RegEx to perform a find and replace on the AssemblyVersion and AssemblyFileVersion attributes within the AssemblyInfo.cs files. Nice!

NCover MSBuild Task

16 October, 2009 (12:45) | Computing, Continuous Integration | No comments

After having configured my MSBuild scripts for use in TeamCity I found this rather nifty page in the NCoverExplorer UI.  You basically configure the NCover report via the UI.  Open up the NCoverExplorer application and click File -> Run NCover.  You are then presented with the Runner dialog box where you set various parameters in the UI.  You can then press various buttons and it will write your Nant/MSBuild or command line for you!  Very neat …

MSBuild – Editing Xml Scripts

12 October, 2009 (10:26) | Computing, Continuous Integration | No comments

Editing MSBuild Xml files can be a bit of a chore. For general everyday file editing I tend to use NotePad++ which is an awesome file editor and viewer. However, you can use Visual Studio to edit your MSBuild files and at the same time get Intellisense!

Open up Visual Studio and go to the Tools -> Options and go to the Text Editor options then you can associate file extensions to text editors. For MSBuild files we need to associate things like “proj” to “XML Editor with Encoding”. Now we also have intellisense to help write the script.

Now Visual Studio will be able to load the .proj MSBuild script into the correct editor and you can obviously associate *.proj files with Visual Studio to launch into them from Windows Explorer.

CI - TeamCity

9 October, 2009 (14:00) | .NET / C#, Computing, Continuous Integration, NDepend | No comments

I have finally completed the set-up and configuration of my new continuous integration system for SampleSort.  I have to say that I’m seriously impressed with TeamCity.  The installation and configuration was straight-forward and has been rock solid.

One thing I would say is that after installation I’d recommending switching to SQL as the database back end immediately.  I started off using the internal database and found the migration tool very awkward so I’m now missing some data from the initial build runs but I can live with that.

I have configured two build configurations for my SampleSort project.  The first build configuration works in Debug mode and runs the following reports:

This debug build configuration is triggered after a Subversion source code commit and is set-up to fail the entire build if there are any tests that do not pass.

The second build configuration works in Release mode and performs a simple Release build of the same source code on the event of a successful Debug build.  The last step in this Release build configuration is to then run an Inno Setup compiler script to package the release mode application into the final application installer.

At the moment this last task is simply an MSBuild Exec command so it all happens outside of the TeamCity scope if you will, this just means that any reporting isn’t included in the TeamCity results.

So far getting this all set-up and configured has actually been a very time consuming task.  There have been many points of confusion along the way so I’m  going to add another blog item soon that goes into a bit more detail of how I went about getting each of these build tasks set-up.  I still have a few niggles that need to be ironed out of my script that relate to MSBuild batching, basically during the test phase there are actually multiple passes of the tests in order to produce the test reports.  This does have a knock on effect of making each build pass a little more time consuming than it need be but also in the great scheme of things this isn’t a huge problem.

I have to say that to have all of this (TeamCity, xUnit, NCover, NCoverExplorer) for free really is inspiring in many ways.  A lot of blood, sweat and tears went into making all of these tools and I’m now benefitting (and my users) with zero financial outlay, I tip my hat to the developers!  I also have to thank Patrick for the free NDepend licence!!

Continuous Integration - TeamCity

28 September, 2009 (12:02) | .NET / C#, Computing, Continuous Integration | No comments

Over the last 6 months I have tried a few CI systems for my own projects. I’ve been looking for something that will formalise the “Clean, Build, Test & Deploy” process so that it’s more predictable, repeatable and almost more importantly - recorded. Nothing major really, I’m not looking to CI to merge the output of multiple streams of development or some amazingly intricate process that itself requires pages of documentation.

I have tried CruiseControl.NET and the more recent offering from ThoughtWorks (an update to CC.NET) Cruise, however these are great systems but can be a bit of a nightmare to set-up I found, at least in light of my particular intended use. I gave up on both of these systems, I found them to be too fiddly to configure.

Anyway, my friend Lee recently got in touch with a very favourable review of JetBrains TeamCity. Since I really wanted to have a CI system in my workflow I decided to take a closer look at TeamCity.

I downloaded the TeamCity Windows installer exe and started the installation process, all seemed to be going very well. Once it had completed I was presented with the page to create an Administrators account and I was then promptly taken to the Projects page. To cut a long story short it appeared that the installation process hadn’t been entirely successful, couple that with an unfamiliar system and I was pretty confused.

There were no Build Agents installed and running on the system and no Windows Services had been installed. On top of that the ‘evaluation’ database seemed to have been installed incorrectly as it had not stored my Administration account which meant that I couldn’t log back in! So, all in all this installation was pretty broken in reality. I was a bit fed up at this point and decided to un-install the software and just get on with some development work.

Anyway, that was on Thursday … on Friday I decided to have another go, went through exactly the same process and low and behold, the installation actually seemed to work. Within about 2-3 hours I had an entire MSBuild process fully configured and running being triggered by Subversion check-ins.

My build process runs right through from cleaning the checkout location, updating the source code from Subversion, running my xUnit tests via Gallio (with reporting). All good! The only thing left to incorporate is once the Build / Test targets have completed successfully is to then run a ‘Package’ target that will produce the final installer executable. However, I may keep this as a separate project, not sure yet.

The upshot is that I can highly recommended TeamCity. Considering all my attempts at getting CI systems working TeamCity is certainly the easiest to get up and running with, I use CC.NET and Cruise at work so it will be interesting to see how they compare once I’ve had a bit more time with TeamCity.

I’m now a student of MSBuild, any good links appreciated!!

Serialization - Xml - Readonly Properties

26 August, 2009 (20:46) | .NET / C#, Computing, Serialization | No comments

I was recently working on a project where I needed to serialize objects with properties marked as readonly (can only be set inside a constructor).  The objects are part of a WCF RESTful service security infrastructure so I wasn’t about to change their design just because I needed to serialize them, there is no need too!  Anyway baring that in mind the lions share of the serialization duties in this project rely on POX (Plain Old Xml) serialisation and XmlFormatter’s etc.  So … if you have an object like this:

You’re almost certainly going to run into Xml serialization issues unless you use a BinaryFormatter object and Serialize/Deserialize that way. In the next snippet you’ll see two extension methods written in C# that perform these tasks and extend both the Object and String types.

This first method takes your CLR object as input and produces a base 64 encoded string object from it ready for storing somewhere.

This next method takes in the string produced from the previous method and turns it back into a a CLR object of the type specified by T.

If you want to have a look at this in action I have produced a small demonstration solution which you can download and have a look at, pinch the code from etc

Reclaiming Disk Space

23 August, 2009 (14:48) | Computing | No comments

I was recently doing a spot of house keeping on the dev box and really needed to have a view on where all the space was being used and by what.  Long and sort of it is that I found this tool really useful, the UI looks a lot like NDepend which is nice!

Get WinDirStat

AES Encryption Weakness

4 August, 2009 (09:02) | Computing | No comments

Interesting article on a recent discovery of a weakness in the widely used AES encryption algorithm.  Seems that you might be better off with AES 192 rather than AES 256!

Read the full AES Encryption article

Introduction to Composite WPF CAL, Prism: Part 2

19 July, 2009 (22:06) | .NET / C#, Computing, WPF / XAML | No comments

I’ve just published the second installment of my mini-series of using the Composite Application Library. This article covers dynamic skinning of WPF applications and a few other choice topics! Check it out here:

Introduction to Composite WPF CAL, Prism: Part 2

« Older entries