Building a ASP.NET Packaging Site Manager Using NuGet

Lately I've been studying NuGet, a system for creating packages of code can install a number of features in an existing project or that is being developed. The operating mechanism is very simple. A package is a file that has a ".Nupkg" (it's a. zip file) that contains a series of folders and files, including the most important one with the ".Nuspec"which is the manifest of the whole package. The package must meet a number of conventions that are available in the documentation for developers here. NuGet was founded for the management of these modules under development, although in Web Matrix, is also used to install extensions at runtime. This function is very useful in all those cases where you need to make customizations of sites / applications and you want to go to install them without having to hack the code or even better without having to open Visual Studio. Searching the internet I find a nice post by Phil Haack, describing a way to create a series of pages to remove, install and update package at runtime. Having failed to find the source code I decided to follow his way and I extracted the code from the library "System.Web.WebPages.Administration.dll” with reflector. This step is necessary because many class have been decorated to serve as internal and not public. Haacked is also confirmed this in his post. The project attached, allows you to manage the lifecycle of packages in a site, is not complete and should be taken only as an example of possible implementation. In this example we see how powerful a tool like this. NuGet can we package as well as portions of applications to create modifications to the configuration files like web.config. Think for example of having to create a package, once deployed should insert a new module in the web.config. With NuGet is much simpler since it is already provided this functionality by default. (745,50 kb)

About the author

Fabio Franzini is Senior Consultant, Software Engineer and Trainer, specializing mainly on SharePoint, ASP.NET, web solutions and in general about everything that revolves around the Microsoft web platform. [more]


Month List

Page List