Base nuget packages for MVC and WebAPI

Jun 23, 2014

Started to learn MVC and WebAPI from scratch, have been working with non-web stuffs (mostly protocols and win-service) for a very long time and just want to get my head around with the Modern Microsoft way to do web stuffs using ASP.NET MVC and / or WebAPI.

So I decided to add my learning notes here as Modern ASP.NET (MAN - slug) blog post series so it can help other starters to jingle and mingle with web using ASP.NET MVC and / or WebAPI.

Current version of ASP.NET MVC is 5.1 and ASP.NET WebAPI is 2.1

So to answer my own question:

What makes the base for any ASP.NET MVC, ASP.NET WebAPI web application and what code base it stands on?

ASP.NET MVC 5.1

I created a new ASP.NET project from Visual studio (.NET 4.5.1) and used "Empty" as template and MVC (checked) for "Add folders and core references for", "No Authentication" and un-checked for "Host in the cloud" - Create / OK.

Navigate to "Manage NuGet" > "Installed packages" - you will see four packages referenced.

Empty MVC - NuGet Packages

  1. Microsoft.Web.Infrastructure - 1 library
    Microsoft.Web.Infrastructure.dll
  2. Microsoft ASP.NET Razor - 1 library
    System.Web.Razor.dll
  3. Microsoft ASP.NET Web Pages (depends on 1 and 2) - 4 libraries
    System.Web.Helpers.dll
    System.Web.WebPages.dll
    System.Web.WebPages.Razor.dll
    System.Web.WebPages.Deployment.dll and some web.config settings.
  4. Microsoft ASP.NET MVC (depends on 2 and 3) - 1 library
    System.Web.Mvc.dll and some web.config settings.

Empty MVC - Library references

So to enable MVC in your web application project template, minimum these four building block packages are required.

ASP.NET WebAPI 2.1

I created a new ASP.NET project from Visual studio (.NET 4.5.1) and used "Empty" as template and WebAPI (checked) for "Add folders and core references for", "No Authentication" and un-checked for "Host in the cloud" - Create / OK.

Navigate to "Manage NuGet" > "Installed packages" - you will see five packages referenced.

Empty WebAPI - NuGet packages

  1. Json.NET - 1 library
    Newtonsoft.Json.dll
  2. Microsoft ASP.NET Web API 2.1 Client Libraries (depends on 1) - 1 library
    System.Net.Http.Formatting.dll
  3. Microsoft ASP.NET Web API 2.1 Core Libraries (depends on 2) - 1 library
    System.Web.Http.dll and some web.config settings.
  4. Microsoft ASP.NET Web API 2.1 Web Host (depends on 3) - 1 library
    System.Web.Http.WebHost.dll.
  5. Microsoft ASP.NET Web API 2.1 (depends on 4) - no library - wrapper packages

Empty WebAPI - Library references

So to enable WebAPI (which is the new way of doing the RESTFUL service) in your web application project template, minimum these five building block packages are required.

All libraries referenced in ASP.NET WebAPI project contains version 5.1.. and still ASP.NET WebAPI is called ASP.NET WebAPI 2.1 - Explained here why?.