Saturday, January 19, 2019

Hello World .Net Core console App with Visual Studio Code

In the previous posts we saw on how to create a simple Hello World console application using the dotnet CLI tools. This is fine for simple applications, when we want to build complex applications with multiple files we need a good editor to view and switch between multiple files in the project.
To build complex .Net Core applications we can use Visual Studio or Visual Studio Code. Visual Studio Code is very handy when we want to build JavaScript based applications. Visual Studio Code is a Free, open-source editor from Microsoft. In this post we shall see on how to use Visual Studio Code to create a simple Hello World .Net Core console application.

To begin with first download and install Visual Studio Code from the following Microsoft website.
https://code.visualstudio.com/

Install the required version of .Net Core SDK, if not already installed in the PC.

Next launch VS Code and navigate to the folder where we want to create the project and open the folder in VS Code. Once in the folder open the Terminal in VS Code (View -> Terminal). Now we can use this terminal like a command prompt and run the CLI commands in the terminal.

To create a new console applications, run the following command in the Terminal.
dotnet new console

The command will create a project file and a Program.cs file, by default the new console application will print Hello World to the console, so we are all set. The Program.cs file will look like the following.




Next we can run the program, we will use the Terminal to execute the run command as follows.



Search Flipkart Products:
Flipkart.com

No comments: