CLI Implementation in .NET Core: Create MVC Projects Easily

What is CLI in .NET Core?

The dotnet Command Line Interface is a cross-platform command-line tool used for developing and performing various development activities when developing .Net Core applications.

Types of command lines in .NET Core

There are three types of command lines in .NET Core.

  1. Basic Commands
  2. Project Modification Commands
  3. Advanced Commands

List of commands

Below is the list of commands to implement in the project using CLI.

Basic commands

Steps to implement the basic commands

Follow the below steps to implement the basic commands.

Step 1. Open the Run windows by entering Windows + R type cmd in the textbox and click the OK button as shown below.

Open cmd

Step 2. The command prompt window will open.

Command prompt window

Step 3. Go to the Command prompt, type dotnet, and press enter key. The user will get all the information as shown in the below image.

Go to command prompt

Step 4. Go to the Command prompt, type dotnet- -list-SDKs and press enter key. The user will get the SDK path installed information.

Type dot NET

Step 5. Go to the Command prompt, type dotnethelp, and press enter key. The user will get the information as shown in the below image.

Type dot net help

Steps to create an Asp.Net MVC project using CLI in .Net Core

Follow the below steps to create an Asp.Net MVC project using CLI in .Net Core.

Step 1. Create one folder in any drive with a demo folder, follow the steps as shown in the image below.

Create one folder

Step 2. Whole MVC project structure will be created in the demo folder as shown in the below image.

Controller

Step 3. To build the MVC project using CLI write the command dotnet build.

Build succeeded

Step 4. To run the MVC project using CLI write the command dotnet run.

Type dot NET

Step 5. The application will run on the browser as shown below with default port no: 5001

ASP dot NET

Summary

I hope you understood this article. We have created an MVC Project using CLI in .Net Core. In my next article, I will explain how to use the advanced command line and add solutions to the project.


Similar Articles