This blog post is part of a series covering ASP.NET 5 To follow along, this post requires installing Visual Studio 2015 CTP.
This post will cover:
- Creating the project
- Examining the project
- Comparing to "Empty project"
The goal of these topics is not only to show “how-to”, but to answer the “what is that…” and “why is that” as well. It is written as if you are following along in Visual Studio 2015 (tutorial style), yet with enough supplemental detail to simply read (article style). Although not an exhaustive dive into each area, it should provide enough context to quickly get started with ASP.NET 5.
Creating the project
To create a new ASP.NET 5 application, it is necessary to think in terms of projects, not web sites. The Web Site… option as seen below is still supported in Visual Studio 2015 to support legacy site development. The specific “ASP.NET vNext” features require the Project… option. With this in mind, in Visual Studio 2015 select from the top menu bar: File --> New --> Project...
After selecting Project…, a new project dialogue box appears. On the left side of the box, select the Web option under the language of preference (Visual C# used below). From there, select ASP.NET Web Application and choose the solution/project name and file location. This post will use ASPNET5 as the solution name, and StarterSite as the project name.
ASP.NET 5 Class Library and Console Application project templates will be covered in an upcoming blog post
Another dialogue box will appear to fine tune the type of web project desired. In this post, we will look at the ASP.NET 5 Starter Web template.
Examining the project
The following is the default structure for the ASP.NET 5 Starter Web project:
A closer look at the wwwroot folder reveals helpful static (non-compiling) content:
The bin folder contains the AspNet.Loader.dll file, which is needed in deployment to IIS.
The css folder contains the site.css file, with minimal style declarations.
The lib folder contains multiple references for support of Bootstrap and jQuery, and contains the _references.js file, which is used to support IntelliSense in Visual Studio.
Back at the project level items, folders such as Controllers, Models, and Views contain what is needed to support MVC.
The Migrations folder contains code to support Entity Framework database migrations.
For an understanding of gruntfile.js and bower.json, take a look at this post by Mike Wasson.
Comparing to “Empty project”
In a previous post discussing how to create an ASP.NET 5 site with the “empty” template, there was significantly less folders and files. This does however help us to appreciate what is truly required for ASP.NET 5 to run. The folder and files below represent the true minimum:
|wwwroot ||Folder of static files served to client. No code or ‘razor’ goes here|
|project.json ||File for managing project settings |
|Startup.cs ||File for startup and configuration code|
The wwwroot folder in the “empty project” only contains the bin with the AspNet.Loader.dll file – much less than what was shown earlier in this post.
The content of the project.json file and the Startup.cs file also differ from the ‘empty’ with more code to support features commonly used. The point here is that much has been added to the ‘starter’ template to provide a basis for common tasks associated with web site development.
In conclusion, there is a solid basis for quick web development when using the ASP.NET 5 Starter Web project template.