First Impression: Horn

Horn is an open source project used to build other often-interdependent open source projects, such as NHibernate, Fluent NHibernate, NHContrib, the Castle suite of projects, MVCContrib, Rhino Tools, and Ninject.

This solves a couple of very common problems when working with the average ALT.NET stack.

  • The dependency tree of the ALT.NET stack is a wind-whipped, gnarled, stunted cedar growing out of the side of a rock cliff. It twists and turns back on itself. It would be a monumental task to grab the correct version of all of these, whether that’s the latest trunk or a stable release, sort out the dependencies, and build them all by hand.
  • The precompiled releases of these projects don’t necessarily correspond to each other. NHContrib Validator might depend on a recent nightly build of NH while FNH v1 RC might depend on NH 2.1 GA.
  • Many of these projects have multi-step build processes. It’s not just a simple “F5” build. There may be codegen tasks, unit tests, assembly signing or any number of oddities.

When I published the first part of my series about setting up the solution, there was an issue where the assembly for Ninject’s ASP.NET MVC integration was only available from the trunk. I posted in the comments that the readers could either wait for me to post the source, including all the 3rd party libraries, or they could grab the source from the trunk and build it themselves.

The next day, I got a series of tweets from Tuna (@tehlike) and @dagda1 about Horn, so I read up on it. It looked cool, but I had just spent the afternoon updating everything and writing about it, so I was a bit burned out. Now that it’s been two weeks, there are a couple of projects in the stack that need to be updated. FNH released v1 RC (Congratulations James!) and Ninject and MVCContrib also have some updates.

I also have two medium sized web apps at work that should be updated to the latest and greatest when we move them from a VPC to a physical server next month. I’m hoping Horn will save me from .NET’s version of DLL HELL.

If you want more info, check out the discussion group, or just grab the source code. Horn even has its own contrib project.

Here are my thoughts:

Very first impression – It’s an awesome idea, but it needs a lot more SEO. To find it, I had to search in Google code. Hopefully, this post will help with that. If you’ve got a blog (and you should) and you use Horn, write about it. It deserves great press.

I grabbed the latest source from their Google Code SVN. In the /src directory, there’s a hornbuild.bat. I fired up a command prompt, changed directories and ran it. 20 seconds later, I had it - /src/build/net-3.5/debug/horn.exe.

From there, I started grabbing everything I needed

horn –install:fluentnhibernate
horn -install:ninject
horn -install:mvccontrib

Well, that’s what I had planned. I got a BadImageException on SharpSvn when trying to grab FNH. After trying a few things on my own, I tweeted for help. Tuna, who I’ve decided is either stalking me or involved in every .NET open source project out there, suggested checking the assemblies with the corflags utility. If you’re new to corflags, like I was, it’s in C:Program FilesMicrosoft SDKsWindowsv6.0ABin and part of the Windows SDK. As it turns out, horn.exe and horn.core.dll in my particular build were not marked as 32-bit. I marked them both as 32-bit with these commands:

corflags horn.exe /32BIT+
corflags horn.core.dll /32BIT+

I tried it again. Success! It started by grabbing the castle project, then built it. Then it moved on the NHibernate, and finally Fluent NHibernate.

In the end, the only project out of the three that didn’t work 100% was Ninject. The build for it’s monorail integration had an issue signing the assembly. Since I’m not using monorail, much less Ninject’s monorail integration, I commented that out of the .build file and tried it again. It worked perfectly.

Horn is still a little rough around the edges. For example, when a build fails, horn crashes out to windows error reporting. Even with those issues, it has saved me a lot of time. It’s a great idea and even at this early stage, it’s an amazing tool.

Thanks again to Tuna for answering my stupid questions.

blog comments powered by Disqus