Category Archives: NuGet

Creating your own NuGet server

Over the years, I have been compiling little code snippets to perform common tasks – like parsing the filename out of a file path, or adding the ever so useful .With() to the string class (supports “My {0} string {1}”.With(“awesome”, “extension”)). I often find myself opening up old projects to find the code and copying and pasting it into my new project. This leads to a lot of splintered code, and it can be a pain finding the latest version. After watching Scott Hanselman’s latest posts on NuGet, I figured it might help me keep things straight. Creating your own NuGet server is easy – however, getting it to run is a bit more complicated 🙂

I am not going to reinvent the wheel here, as Phil Haack has done a great job here. Some things to note:

  • You can install this in to an existing website (I added it my website using MVC3)
    • However, be aware it does add a default.aspx that you will want to delete so that people still see your old homepage
  • If you are deploying this to a server that binds multiple sites to the same ip address, make sure to add the following to your web.config
    <serviceHostingEnvironment multipleSiteBindingsEnabled=true />
    • Otherwise, you will get errors along the lines of “This collection already contains an address with scheme http”
  • Make sure to add .nupkg to your mime types on IIS (right click properties on the server in IIS MMC)
    • .nupkg application/zip should do it
    • Otherwise, you will get 400 or 404 errors when you try to request your package