Adding Core References Support in an ASP.NET Empty Project
Brief
In Visual Studio 2013 we introduced the core reference framework to ASP.NET project creation. You can choose what core references you want in your to-be-created project.
How
Let’s take the example of adding Web API core references in an
Empty ASP.NET Project
- Open Visual Studio 2013 New Project Dialog
- Choose “ASP.NET Web Application” under “Web”
- Select any template in the New ASP.NET Project
dialog.
Notice the three check boxes under “Add
folders and core references for:” - The availability of Web Forms, MVC and Web API depend on which template you choose. For example, MVC is always selected for the MVC template. When you select Empty, all three are optional since it
is an empty template. - To add Web API core reference, select Web API, then OK, and then create project.
- Examine the packages.config:
Web API NuGet packages are all added. - Examine the Global.asax.cs:
Web API is also registered.
Summary
As you can see, adding the core references will not only add the required NuGet packages but also correctly configure the app for the selected core reference.
Similarly you can add MVC and or Web Forms support in the same way. And the supported core references are not limited to empty template only. They’re supported on all six template.
This approach is a very helpful function to set up a customized ASP.NET project quickly.