Explain how to create a new ASP.NET Core project


Before you begin with ASP.NET Core, you need to install the .NET software development kit (SDK) using the following link.

Download .NET SDK

To check if everything is installed correctly, open a new terminal window and run the following command:

$ dotnet --version

If the installation was successful, the program should report its version, e.g. 5.0.100.

Create Your App

Now that you have installed the framework, you can create a new ASP.NET application. NET comes with several pre-configured generators designed to make the developer’s life easier by creating everything necessary to start working on a project.

To see all the available generators, run the dotnet new command in a terminal. You should see the following output.

This tutorial focuses on using ASP.NET to build a web application that uses the Model-View-Controller (MVC) pattern, which we will learn about later in a future post. We will use the MVC generator to scaffold a complete web application using the following command.

$ dotnet new mvc -o blog

This creates an ASP.NET MVC application called blog in a blog directory. The -o parameter creates a directory named blog where your app is stored. You can see all the command-line options that the dotnet new command has by running

$ dotnet new --help

After your application is scaffolded, switch to the directory.

$ cd blog

This directory contains the files and folders that make up a complete ASP.NET application.

Run Your Application

Let’s get something up and running on the browser. In the terminal, run the dotnet run command, which first restores all the dependencies, builds the project and finally runs the application.

To see your application in action, open a new browser window and go to https://localhost:5001. You should see the default ASP.NET welcome page.

Updated on: 22-Jun-2021

183 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements