Hornget, Why I think it needs binaries

Today I learned about the Hornget project which is lead by Paul Cowan. Hornget attempts to solve the elusive “package manager for .NET” problem by creating a packager system for open source .NET projects.

An interesting choice the Horn project team made was to keep the repository (not the design pattern, the actual place where the project meta data is stored) building from source and eschew binary packages altogether. Paul actually makes a very compelling case for this choice in his presentation at DSL DevCon.

While I agree that having the build from source option available is a good idea, I don’t think it should be the default option. Or at least, I think that a binary install option of equal weight should be available.

The Horn dependency and package system is based, at least in part, on the Gentoo Linux Portage manager. When Gentoo first showed up on the linux scene I started using it as my linux desktop and server of choice. The Portage system has awesome dependency resolution and listed the latest and greatest versions of packages like KDE, Gnome, and all the STABLE versions my favorite applications. I highlight stable because that’s what I like to use – the stable version – especially for important or production situations.

The thing I hated about Gentoo was waiting for packages and their dependencies to compile. Most small applications built fast. Most large ones, like x-org, Gnome, and KDE didn’t. The process usually went something like this: Start build, go to bed, wake up the next day and hope there were no build errors.

Now to be fair, there are no packages in Horn that will take all night to build. However…

log4net Build Failure
log4net Build Failure

This is what happened when I tried to install log4net from source. The build failed. This happens more often than people may think. And it’s why I think a “install from binary” option is needed.

Pauls argument for building from source via his presentation goes something like this:

  1. All developers like to use the bleedingest edgiest version of a software package so we all download from trunk and compile.
  2. Because of this, we have dependency issues during builds because the source from a dependent package may be out of date. Thus, that package also needs to have the freshest source pulled and built. (ie, dependency checking and resolution)

I agree that these are issues. But only when building from source. The question then becomes, do most developers use the latest trunk builds of open source projects like Nhibernate, Castle Windsor, and MVCContrib?

Having spent a lot of time on both the MSDN and ALT.NET side of the developer camps, I’m comfortable saying that a lot of people don’t want to build from source. They don’t want to use the latest bleeding edge version. They just need the package to work stably and reliably. Horn pulls the source from the repository itself where the project is hosted. (so far only svn is supported but git is on the way) There is no gateway to be sure packages are stable and feature complete. Just because something builds doesn’t mean it’s ready to be tagged as the next version.

This raises some more questions which I haven’t been able to answer myself yet: Who decides what packages are inside of Horn right now? Presumably Paul and his team are playing things a little close to the vest right now, adding prominent open source projects to their repository, and making sure they build correctly.  And that’s the right thing to do. But who decides when the next version of a package is ready to be included in the repository? Does the original developer team have a say? If they commit each night and the Horn build “checker” doesn’t fail does this mean that a new build of a project is available each day? In the future, will I be able to add my own open source project to the Horn repository? Will I have any control over how often it’s versioned?

I’ve actually been thinking a lot about this problem over the last couple of months and I think I have a solution which I’ll detail in a future post.

For now, however, I really do wish the Horn project team well. I’ve already joined the Google Horn Developer Group to follow the goings on and will hopefully be able to inject some opinion about adding binary support.

Give the Horn project a look. It very well could be the future of .NET package management for community and open source projects!

Multipart Form Posts in .NET

Recently I decided I wanted to develop a small, lightweight Windows client to use for Baconfile, Leah Culver‘s latest side project for easily uploading files to Amazon’s S3 service. Chris Wanstrath made a nice little Mac client and I thought Windows users might enjoy the same type of functionality.

After deciding on how I wanted the app to look and feel, I got to work. At least, I tried to. Strait away I ran into issues in both trying to write a Windows Explorer extension in .NET and POSTing a multi-part form POST. I don’t want to devolve into too much of a rant but it IS 2009 and we STILL can’t write simple Explorer extensions using managed code which just reinforces my feeling that .NET programmers are second-class Windows citizens. Version 4.0 is around the corner and I still have to import kernel32.dll to perform some basic OS functions.

The other problem, POSTing a multi-part form POST turned out to be a little bit more surmountable an issue. The goal was to use the Baconfile API to upload a file. In other languages such as Ruby, constructing a multi-part form post is actually quite simple. In C# it is not. Between HttpWebRequest and the WebClient Upload method, there was no way to create a custom post whereby I added some arbitrary number of POST parameters.

After awhile I found Brian Grinstead‘s post about how he had constructed his own class that enabled users to create their own custom-formed multi-part form POST. Considering how often a function like this is used, especially on public APIs, I was as surprised as he was that this kind of functionality wasn’t in the .NET framework itself. His example class worked flawlessly.

I needed to add some tweaks such as basic http auth and so I created a new GitHub project to support the work.

I plan to add more functions such as a cookie container, ActiveDirectory auth, and whatever else seems logical. If I’ve missed something and there really IS an easy way to do this using out-of-the-box classes in the .NET framework, please let me know.