Implementing CLI (Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core

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.
 
There are three types of command lines in .Net Core,
  1. Basic Commands
  2. Project Modification Commands
  3. Advanced Commands.
Below is the list of commands mentioned to implement in the project using CLI,
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
Follow the below steps to implement the basic commands. 
 
Step 1
 
Open the Run windows by entering Windows + R and type cmd in textbox and click OK button as shown below,
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 
Step 2
 
Command prompt window will open.
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 
Step 3
 
Go to Command prompt, and type dotnet and press enter key. User will get all the information as shown in the below image.
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 
Step 4
 
Go to Command prompt, and type dotnet- -list-sdks and press enter key. User will get the sdk path installed information.
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 
Step 5
 
Go to Command prompt, and type dotnethelp and press enter key. User will get the information as shown in the below image.
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 
Follow the below steps to create Asp.Net MVC project using CLI in .Net Core.
 
Step 1
 
Create one folder in any drive with demo folder, follow the steps as shown in the below image.
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 
Step 2
 
Whole MVC project structure will be created in demo folder as shown in the below image,
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 
Step 3
 
To build the MVC project using CLI write the command dotnet build,
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 
Step 4
 
To run the MVC project using CLI write the command dotnet run
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 
Step 5
 
Application will run on the browser as shown below with default port no: 5001
 
Implementing CLI(Command-Line) In .NET Core And How To Create MVC Project Using CLI In .NET Core
 

Summary

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

Similar Articles