Rake is normally used as a build tool scripting language (if used for anything else, please do comment). I’ve been using it for almost 2 years in place of NAnt and MSBuild due to its programmability. Executing a concise script to do anything I want for my build process is a great bonus rather than writing complex XML configurations. At work, I hook this script into the team city build server (which supports running rake tasks). My tasks ranges from versioning, unit-tests, deploy to staging and manual click to deploy to production, without having server specific features. Anything the build server can do, I can do it from my machine.
To get started with rake in .NET, here are the steps that easily gets you up and running:
- Download ruby and install it. Ruby comes bundled with rake. Ensure they are installed in your Environment PATH. If somehow rake isn't bundled with ruby, its a gem anyway so install it with:
gem install rake
- Install Albacore gem, a set of rake task made specifically for making building .NET projects easier. Tasks include running NUnit and MSTests, zip, nuget deployments, etc. Getting started found here. To install the gem:
gem install albacore
- Download the visual studio plugin Rake Runner for visual studio 2012+. This allows you to run available rake tasks from the solution explorer.
- Create a visual studio project, place your Rakefile in the root folder of your project. This file should show up under Solution Items folder. This is where you write your scripts. Paste this code:
desc "Build" msbuild :build do |msb| msb.properties :configuration => :Release msb.targets :Clean, :Build msb.solution = "YourSolution.sln" endReplace the name of the solution with yours. Right click your solution, go to rake(Rake Runner extension) and select Build (refresh if not shown). The project should be built and the output shown in the output window pane.
- Go read this small tutorial which should help you get off the ground to writing some complex build scripts.