Some time ago I had two posts about using RAKE to build your .net solutions. Back then I did it quick and dirty, with a promise to make it better in the future. I had great plans. I wanted to:
- Create custom tasks
- Create nice little reports
- Automatically publish to the web server
Well some time has passed and some “new” projects popped up. And I let it rest for some time, again. But problems don’t get solved by ignoring them. So it caught up with me again.
This time I was certain to get the deed done. So I opened my ruby editor and started to type RAKE build scripts. And the individual tasks exploded again. Before taking a big chunk out of my time to create custom tasks I searched the net for people that already did that work for me. And after some searching I did.
The solution to my problems came in the form of the albacore. You can find them at http://github.com/derickbailey/Albacore.
It comes with a lot of predefined custom tasks that will make your build work much easier.
Just to give a quick example here is a very simple build script that will build your solution and run some nUnit tests.
require 'albacore' task :default => :test desc "Build solution" msbuild :msbuild => :prepareOutput do |msb| msb.properties :configuration => :Release msb.targets :Clean, :Build msb.solution = "../Sources/Hangen/Hangen.sln" end desc "Run unit tests" nunit :test => :msbuild do |nunit| nunit.path_to_command = "../Lib/Nunit/nunit-console.exe" nunit.assemblies "../Sources/Hangen.Tests/Hangen.Tests.csproj" nunit.options '/xml=Output/Hangen.Tests-results.xml' end
And that’s the complete build script. I don’t know about you but this is extremely cool in my book.
So check it out.