Pages

Friday, July 27, 2018

Create dotnet core console application using Visual Studio code from the command prompt

Prerequisites:

.NET core and Visual Studio Code setup is completed.

To cross check if  .NET core is installed and path is configured type

>dotnet --version 

in the command prompt







Returning the version indicates that the dotnet core was successfully installed.

.NET CLI --It is the tool which is used for creating the console application i.e scaffolding ,debugging and building the console application.

Create HelloApp

There are multiple ways to create the console application.

In the command prompt , run the following command

>dotnet new console -o HelloApp




The dotnet command creates a new application of type console.The -o parameter creates a dircetory named HelloApp where your app is stored and populates it with the required files.

The HelloApp has Program.cs file when run prints Hello world on console.

Nvaigate to HelloApp from command prompt using the following command 

> cd HelloApp








Run the Application

Run the application using the command 

>dotnet run

 to see the output Hello world!







Open the App in Visual studio code editor
-----------------------------------------------------
To open the project in the visual studio code editor from the command prompt type the following command

>code .






Congratulations on your first .NET core console application :) .Happy Coding!

No comments:

Post a Comment