5

For insight into the below, read: http://martinfowler.com/articles/rake.html

I've been using Rake (with Albacore) recently, and like it alot. Mostly the strength of having the Ruby language right at hand when I need it.

I must admit I am alot more at home with C# - and that lead me to thinking if there was an equivalent to Rake in the .NET world.

What I am looking for is a way to write build scripts in C#, or maybe a DSL, having the same dependency programming model, where I can also use C#.

Maybe I'm way off base asking this question. But if it's possible to do with Ruby (and an internal DSL), then I can't right off the bat say why the same wouldn't be possible for C#. And I certainly don't understand why it hasn't already been done :-)

Anyone have some perspectives on the issue?

What we already know:

  • C# needs to be compiled to run, so we would need to create a seperate build-script, that is parsed, and compiled at run-time by an executable.

Thanks in advance!

Solution

Use "Cake" http://cakebuild.net/ -- with Roslyn compiler what I wanted (years ago) is now possible. Thanks Microsoft. And thanks to the people who wrote Cake.

An alternative is to use Powershell. The library is called Psake (saké)

Amittai Shapira
  • 3,749
  • 1
  • 30
  • 54
  • Check http://stackoverflow.com/questions/2425757/net-c-build-tool-is-nant-a-preferred-tool – Hauleth Mar 16 '12 at 23:52
  • Because C# isn't a scripting language. – Andrew Marshall Mar 16 '12 at 23:53
  • @AndrewMarshall: It's not too bad as a scripting language either. The only downside is that it (still) requires compilation. – Niklas B. Mar 16 '12 at 23:53
  • @NiklasB. I suppose what I meant to say was *interpreted*, and thus requiring compilation to run. Scripting and interpreted (perhaps unfortunately and incorrectly) seem to get combined together a lot, and I'm guilty of doing so myself. – Andrew Marshall Mar 16 '12 at 23:58
  • @Andrew: I realize that. That's why I am talking about a DSL. The point is you would write a build-script, and have an executable that would parse the DSL, and compile and run it at Runtime :-) –  Mar 16 '12 at 23:58

3 Answers3

5

Maybe Cake is what you're looking for: https://github.com/cake-build/cake

Patrik Svensson
  • 13,536
  • 8
  • 56
  • 77
  • This is now the correct answer. With the advent of Roslyn, what I was wanting back in '12 is now possible with Cake. I actually wrote a similar project, also called cake, that did the exact same thing, but, The real 'Cake' is far superior to my implementation. –  Oct 18 '16 at 09:34
3

A lot of people do use Rake for build scripts. There are even Rake tasks just for .NET. http://albacorebuild.net/

But there is a c# based make utility I know about. http://shake.codeplex.com/ And I thought I saw one on github. But I think they require a compile and that didn't seem as cool.

I ended up on https://github.com/psake/psake mainly because I wanted to learn Powershell and everyone already had it installed.

Hmm Bounce too https://github.com/refractalize/bounce

nportelli
  • 3,934
  • 7
  • 37
  • 52
  • Yeah, I use Albacore already. Sorry, I'll update the question. I think the powershell approach is also very interesting. +1 for that.. I didn't even consider it! It seems the idea has cropped up elsewhere, but is still in it's infantsy. –  Mar 16 '12 at 23:57
  • And agreed. I don't want to compile it before I run it. Or atleast, I want to be able to write something like: "cake build.cs", and it would compile and execute the build-script. So of course I am dependant upon a compile *somehow*. –  Mar 17 '12 at 00:09
0

You can script your build/deployment tasks with msbuild and then script your tasks and execute them from bat files.

Soniku
  • 154
  • 1
  • 5