Basic ASP.NET 5 with Visual Studio 2015

The next version of ASP.NET is making a lot of progress and after watching Introducing ASP.NET 5 and Deep Dive into ASP.NET 5 from Build I decided to give it a try. The idea is to get the same Contacts application running in the new version of ASP. This will be a new solution so I am not trying to convert my existing solution and projects. With ASP.NET 5 Visual Studio is not the only option (Code is another option) for development, but Visual Studio is the route I am using for now.

The first step is to download and install Visual Studio 2015. Visual Studio 2015 has a ton of new stuff which I am not going to cover, but if you are interested check out this post from the Visual Studio Blog.

Next open Visual Studio and click File > New Project. This will show the new project dialog. At the top make sure you have .NET Framework 4.6 selected. Under Installed > Templates > Visual C# > Web select ASP.NET Web Application.aspNet5NewProjectNext the New ASP.NET Project dialog shows. Under the ASP.NET 5 Preview Temples select Web Site. This template will give the closest match to my existing Contact application.

aspNet5NewAspNetProjectAfter a minute or so the new project will be created and you will have something similar to the screenshot below.

aspNet5SolutionExplorer

For some reason I had a lot of problems getting the project to create properly. The project would get created but would be missing Models, Migrations and the views and controllers related to authentication. To get around this issue I cloned the ASP.NET Docs repo. The samples folder contains a project call WebApplication1 which contains all the needed files.

With WebApplication1 rename I was able to build and publish with no problems. I was going back to make screenshots for this post and the project creation actually worked. I am not sure if the act of publishing fixed something for Visual Studio, but now any Web Site temple project works fine.

At this point you will have a runnable application. I recommend checking out the Project_Readme.html that will be in your project as it has tons of information about all the stuff that has changed in ASP.NET 5. The videos linked at the top of the post are also a good place to start getting a handle on the new world that ASP.NET 5 is creating.

Other than the hiccups with project creation it is just as easy to get an application up and running in ASP.NET 5 as it was in ASP.NET 4. Compare a newly created project in ASP.NET 4 vs the one created here and you will notice tons of differences. Over the coming weeks my plan is to get this new application up to the point that the Contacts ASP.NET 4 application was at. From there the plan is to continue its development, and more importanly my learning, in ASP.NET 5.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.