Thanks to Kevin Halleran for the title. And no, I’m not talking about candy bars. I’ve been a fan of NuGet for a while now so I’m putting together a few blog posts on the why's and how's of using it for Custom Software Development.
What is NuGet?
If you haven't heard of NuGet already, your either not a .NET developer or you need to get out of your cube more. NuGet is *THE* package manager for .NET with over 120K packages and 100M+ downloads (as of September 2013)! Created by the OuterCurve Foundation, NuGet allows developers to quickly and easily add references to third-party frameworks and libraries. By quickly and easily, I mean that with a few clicks or keystrokes you can download, reference and configure your .NET project to take advantage of a useful piece of functionality.
Let's use the excellent Error Logging Modules and Handlers (ELMAH) package as an example.
With a few clicks or keystrokes and less than 1 minute, you can add ELMAH to your ASP.NET project, have your web.config automatically set-up, and be running your website with a proven error handling framework! (Learn more about ELMAH - above image courtesy of ELMAH site)
Why We Use It
In Custom Software Development, we build and maintain lots of systems. As consultants, we want to eliminate duplicated effort to provide our clients with the most for their money. Our Foundation.NET architecture has been proven time and again to rapidly get a project off to a solid start. In moving Foundation to our own NuGet server (more on that in a later post) we've broken it into separate components to allow us to consume only the parts we need for a particular project. With updates to Foundation and Visual Studio release cycles coming more and more frequently, our previous model of having “starter projects” set-up with all the necessary references and configuration was becoming a burden. By utilizing NuGet, we can now create a new project, install the packages we need and be up and running in short order.
Versioning of Foundation is easier now too. We simply add the new features or make the needed tweaks, package and deploy. Existing projects can see the new version and choose to upgrade themselves if they like, with only a few clicks or keystrokes. Since Foundation uses CSLA and parts of Microsoft's Enterprise Library, our Foundation NuGet packages are built with those dependencies. This eliminates even more headaches from trying to keep our starter projects up-to-date.
Not Convinced Yet?
Don't have a great framework to re-use? Ask yourself this question: how many times have I cut and pasted some boilerplate code from one project to another? Or maybe you've had reason to share some common functionality with a co-worker or another team? Maybe you've even come up with your own scheme for sharing code or assemblies.
NuGet makes it so easy to get started. Install, uninstall, versioning, dependencies, documentation… it's all baked in to NuGet. And if you don't want to share your work with the world, it's easy enough to set-up your own NuGet server. It is simply creamy goodness!
Stay tuned for our upcoming post, Getting Started with NuGet, when I will walk through how to use NuGet to add an error handling tool to a web project using Visual Studio.