Since a new MVC 4 Internet project has no less that 47 references and 29 nuget packages. I'm wondering what the least number of references I can get away with. I'd like to choose my Javascript and ORM solutions. I basically just want the barebones MVC Framework. What can I get rid of ? And for bonus points what is the minimum I have to add to get WebApi working ?
3 Answers
Just for the sake of completeness, here are the minimum references I found to be needed for a working ASP MVC application deployed to IIS (in my case version 7.5). That is to say, if you have these references only, your MVC application will run, and if you don't have all of them, it won't run. Also, keep in mind I'm speaking from a deployment perspective, not a local development web server perspective. Running locally without all these references may work but end up failing when deployed to IIS.
Minimum References
REFERENCE COPY LOCAL*
--------- -----------
Microsoft.Web.Infrastructure true
System false
System.Web false
System.Web.Http false
System.Web.Mvc true
System.Web.WebPages true
System.Web.WebPages.Deployment true
System.Web.WebPages.Razor true
*Copy Local is set to false for these references when they're added to your solution. Set the Copy Local property for the references above accordingly to make sure the DLLs are put into the bin directory when building the project. That way, they will be picked up for deployment.

- 887
- 9
- 12
-
Yep better than my answer. Thanks. – Mark Broadhurst Apr 03 '14 at 13:08
So its been a while, On update 2 there seems to be a empty template which still has a load of unused references, Once you have created the solution you can safely remove the following references:
- Microsoft.CSharp
- Microsoft.Web.Infrastructure
- Microsoft.Web.Mvc.FixedDisplayModes
- Newtonsoft.Json
- System.ComponentModel.DataAnnotations
- System.Data
- System.Data.DataSetExtensions
- System.Drawing
- System.EnterpriseServices
- System.Net.Http.Formatting
- System.Net.Http.WebRequest
- System.Web.ApplicationServices
- System.Web.DynamicData
- System.Web.Entity
- System.Web.Extensions
- System.Web.Helpers
- System.Web.Razor
- System.Web.Services
- System.Web.WebPages.Deployment
- System.Xml
- System.Xml.Linq
and from a Nuget point of view you can remove all of the packages except (and their dependencies) :
- Microsoft.AspNet.WebApi
- Microsoft.AspNet.Mvc

- 9,869
- 15
- 60
- 87

- 2,675
- 23
- 45
Then don't choose the internet template. Instead, choose the empty or basic templates. That's what they are there for.
The Internet template requires every reference it has. If you want to remove some of those references, you have to remove code from the template.
All of the templates, however, seem to include some packages you may not need, like json.net or WebApi, but those can be removed if you don't need them.

- 92,674
- 28
- 195
- 291
-
1I'm looking for more of a diagnostic answer rather than use a different template with suffers from the same problem, but less so. – Mark Broadhurst Sep 25 '12 at 08:29
-
@SaintGerbil - Then the answer is that the Internet Template requires all its references. If you want to remove references, then you will have to also remove code, such as the AccountController (which is where the majority of the references are needed). – Erik Funkenbusch Sep 25 '12 at 16:03