Wed Nov 17 2010

What do you get when you cross, MVC3, NuGet, and a WebMatrix Helper? Well one big bag of awesomeness, of course.

Did you know you can install the WebMatrix Helpers in a MVC3 Site with NuGet?  It's a dirty little secret I know.  We also know a WebMatrix is built on top of not only ASP.NET but supports the Visual Studio "Web Site" project type.  Ironically that isn't really a "project" type since there isn't a "project file".  For purposes of this conversation we are going to play around with my Url Shortener Helper.  At this time of writing this, the current release is 0.9.1.  you can get more information about it here: http://csell.net/2010/11/16/UrlShortenerV091Release.aspx

My helper was actually included in this past release of WebMatrix but what does that really mean?  Well there is a NuGet feed that drives the selections seen when you browse to the _admin portion of a WebMatrix site.  That right there is a whole pile of awesomeness.  Originally I was a bit sad it didn't make it into the official NuGet feed.  I realize my helper isn't anything complicated or even all that special but still everyone should get to use it.  There is nothing technically that says you can't use it in MVC3 projects.

So I started to do some poking around. What if I could get that feed? Well as it turns out, you can.  The current address is: http://go.microsoft.com/fwlink/?LinkID=205388.  Of course that could change at a later date.

At this point if you don't' have NuGet installed, look that puppy up in the Visual Studio Extension Manager or get it from CodePlex. Here is a great screen cast on using NuGet with MVC: http://userinexperience.com/post/Mvc-Screencast-1-NuGet.aspx.

With NuGet setup we can add that feed to the list of feeds we already have.

image

Now lets go to the Package Manager _and call **_List-Package** on that new source.  You see we now have the WebMatrix Helpers.

image

Sweet! Now call install-Package UrlShortener on your MVC project.  That will drop in the two assemblies into the bin folder and the readme.txt in the root. Just configure the helper and use it.

SNAGHTML4fcfbe