tags:

views:

377

answers:

2
+4  Q: 

Rake for .NET

What is the best way to build a .NET solution and run MbUnit tests using Rake?

I'm currently invoking commands directly like this:

sh "#{DOT_NET_PATH}msbuild.exe /p:Configuration=#{CONFIG} #{SOLUTION}"

This works but seems a bit rubbish. Are there any gems people would recommend using?

+1  A: 

rake-dotnet is pretty useful, if rather new (though that's admittedly pretty shameless of me ;-) ).

Source code

Peter Mounce
+6  A: 

I just started using albacore which is available on http://github.com/derickbailey/Albacore.

Full docs at the wiki

Your task for executing a build is this simple:

msbuild do |msb|
 msb.solution = "mysolution.sln"
 #... other settings here
end

Want to execute unit tests?

desc "NUnit Test Runner Example"
nunit do |nunit|
    nunit.path_to_command = "NUnit/nunit-console.exe"
    nunit.assemblies << "assemblies/TestSolution.Tests.dll"
end

UPDATE: Check out this May 2010 article for a very comprehensive tutorial.

Jason Watts
Yes, I'm using this myself now. It's great. If I'd remembered this question I'd have added this answer myself.
Garry Shutler
You might want to come back and edit this question soon as the syntax is going to be changing slightly to just "nunit" instead of "nunittask".
Garry Shutler