Develop ASP.NET Core Web Application

Develop ASP.NET Core Web Application

Last time I showed how to develop a .NET Core 1.0 Console Application using Visual Studio Code on macOS. Now I want to quickly show you how to get started developing an ASP.NET Core Web Application. This can be used as the basis for learning .NET Core, ASP.NET Core, Entity Framework Core, etc. I am running this on macOS, but the dotnet CLI is cross platform and works the same way on Windows, Linux, etc.

Like the .NET Core Console Application, I start a macOS terminal session and create a directory for my ASP.NET Core project.

mkdir aspnetcore && cd $_

Next I will run the dotnet CLI command that creates starter files for an ASP.NET Core Web Application Project.

dotnet new -t web

The -t command line option specifies a template. If you leave it off, you get a console application by default, which is what I did in the past couple of tutorials. In this case, however, I am specifying the web template, which will create a feature-rich ASP.NET Core Web Application that one can use as a starter project and learning tool.

Now we have to restore all the packages used by the web template.

dotnet restore

You will notice a lot of packages being used by this template, including logging, configuration, Entity Framework, SQLite, authentication, LINQ, etc. It will take a few seconds to install all the packages.

At this point you can open up Visual Studio Code if you wish to look at the project.

code .

However, you can just run the web application from the command line.

dotnet run

Since this is a web application, you will need to open up the browser to view the application. By default you will need to open up localhost:5000. You should see the following in your browser.

ASP.NET Core 1.0 Web Application