Rake for .NET in 5 Minutes

There’s no question—when it comes to writing build scripts, I’ll take rake over just about anything. Especially anything that requires defining a script using declarative markup (I’m looking at you, MSBuild and NAnt).

If you want to build .NET projects with Rake, here’s the fastest way to get started with Ruby and Rake on a Windows machine (you can skip to the end for an even shorter list).

Install Ruby 1.9

Visit http://rubyinstaller.org/downloads/ 

image

Download the latest Ruby 1.9 installer:

image

Run the installer.

I recommend checking the option to add Ruby executables to your PATH.

image

Install DevKit

Ruby libraries are called gems. They can be installed and uninstalled from your system as easily as adding and removing an app from an iPhone. Usually.

Some gems come with source code in a language other than Ruby, such as C or C++, and they assume that they’ll be installed on a Unix or Linux style machine system where tools like make, gcc, and sh are present. Naturally, these gems don’t install so well on Windows. DevKit fixes that.

Download the DevKit self-extracting archive from the same page you downloaded the Ruby installer: http://rubyinstaller.org/downloads/

image

Run the DevKit executable.

When the dialog asks where to extract to, change the folder to C:\DevKit (just consider this the DevKit installation directory).

image

Open a command prompt and do the following:

cd \DevKit

ruby dk.rb init

ruby dk.rb install

Then, to make sure it installed correctly, do:

gem install rdiscount --platform=ruby

If all is well, you should see the following line while rdiscount is being installed:

Temporarily enhancing PATH to include DevKit...

Update the Gem System

At the command prompt:

gem update --system

This will update the gem system to the latest available version.

Install Gems

faster_require

gem install faster_require

This little gem speeds up the performance of the ruby “require” statement on Windows. In some cases, quite a lot. I always include it on any Windows machine I use.

rake

gem install rake

This is what we’re after, after all.

albacore

gem install albacore

Albacore is a gem with a set of rake tasks that help with building .NET projects, including a task for executing msbuild which you can use to easily build a Visual Studio .sln file.

Done!

That’s it. You’re ready to start building your .NET projects with rake on Windows.

Recap: The Short List

Here’s the shorter list:

  • Download and install the latest Ruby from http://rubyinstaller.org/downloads. Include Ruby executables in PATH.
  • Download DevKit from http://rubyinstaller.org/downloads. Extract to C:\DevKit
  • Install DevKit
    • cd \DevKit
    • ruby dk.rb init
    • ruby dk.rb install
  • Verify DevKit install
    • gem install rdiscount --platform=ruby
    • Should see: Temporarily enhancing PATH to include DevKit...
  • Update gem system
    • gem update --system
  • Install gems
    • gem install faster_require
    • gem install rake
    • gem install albacore

0 Response to "Rake for .NET in 5 Minutes"

Post a Comment