You can code it, I can help!

.NET Dependency Management

The problem

One of the features that I miss when I work in .net is a tool to retrieve my dependencies (i.e. assemblies, tools) from a centralized server to avoid copying them again and again from project to project. In the java world Maven does that (and much more) for you, and in the Rails world a utility called Gems (a gem is a ruby library) exists that will download and install the dependencies of your project for you. To illustrate the point, let’s look at the .NET Media Library project. The project file structure looks something like this: +—Media Library

+—Main: main source, all the projects are in here.

+—Test: Testing source, all the testing projects are in here.

+—Lib: Dependencies for the projects.

+—Tools: Tools to be used to build, test, deploy, etc.

I have to potential candidates to store external resources (actually I’m using SVN externals, but is giving me lots of grief), lib and tools. Under lib I have the libraries like: And under tools I have Every library and every tool has a particular version, even some of them have dependencies on their own that I have to compile, store and copy every single time I start a project or I want to upgrade. What to do? What to do indeed….

A new project is born

What to do? Create my own, of course. Disclaimer: I don’t want to reinvent the wheel, so, if you know of a similar project, please let me know ASAP! My goal is to build a tool that will use a configuration file in which I can declare my dependencies and will download them from a known host. Similar to Gems I’d like to use a DSL (Domain Specific Language) to be declarative and have a clear syntax to describe, versions, sources, targets, aliases, etc. However, I’d like to take advantage of another language that I can build on top, to have lots of features out of the box that otherwise I need to implement on my own.

Don’t be scared, BOO is here!

What better candidate than Boo? Quoting the site:
Boo Boo is a new object oriented statically typed programming language for the Common Language Infrastructure with a python inspired syntax and a special focus on language and compiler extensibility.
After using Binsor in a few projects I was convinced that Boo is an excellent choice to build the tool. So my first step was to buy the book DSLs in Boo: Domain-Specific Languages in .NET, and start reading.

First Draft DSL Syntax

Let’s imagine that we want to declare dependencies for the .NET Media Library, here is my idea so far:
lib_folder lib
source http://MavenThought.com/nass

# Testing libraries
lib MavenThought.Commons, 0.2
lib MavenThought.Testing, 0.2
lib nunit, 2.5
lib SharpTestEx, 1.0
lib SpecFlow, 1.2

# Castle Stack
lib Castle.Core, 1.1
lib Castle.Windsor, 2.0

lib NHibernate, 2.1
lib SQLite, 2.1

# Web framework
lib OpenRasta, 2.0.3
lib JSon.NET, 3.5
The lib keyword declares the dependency and the version and we can see at the top the configuration for the destination folder and the source to get the dependencies. Because we are using Boo we can use the comments, etc… Any feedback?