Getting Started With .NET Core And Visual Studio Code

.NET Core

ASP.NET Core is an open source and platform-independent software framework for developing web, mobile, and desktop-based applications using Windows, Mac, and Linux operating systems (a developer can develop the desktop application from .NET Core 3.0). .NET Core supports command line interface for developing the applications.

ASP.NET Core fully supports C#, F#, and partially supports VB.NET. Currently, VB.NET compiles and runs on .NET Core, but the separate Visual Basic Runtime is not implemented. Microsoft announced that the latest version, .NET Core 3 will include the Visual Basic Runtime.

Why .NET Core?

Due to the following reasons, developers should use the .NET Core framework for development.
  • Cross-Platform Development
  • Targeting Microservices.
  • Lightweight
  • Docker Containers support
  • High-performance and scalable systems
  • Side-by-side .NET versions per application.
Versions History

 Version Number Release Date
 1.0 06-27-2016 
 1.1 11-18-2016
 2.0 08-14-2017
 2.1 05-30-2018
 2.2 12-04-2018
 3.0 In Development

IDEs for Development

There are a lot of IDEs available for developing but most of the developers use Visual Studio and Visual Studio Code for development.
Software Installation

  • Windows 8.1 or higher OS, or Linux
  • Visual Studio 2017 or Visual Studio Code

Let's install .NET Core 2.1.502 on Windows OS

Please download and use the SDK from here.

Once the SDK is downloaded, follow the below steps.
Step 1
Double-click the downloaded file.

Step 2
Click on the "Install" button.

Getting Started .Net Core with Visual Studio Code
Step 3
In the Permission pop up, click "Yes".

Step 4
Then, you will see a process window like below.

Getting Started .Net Core with Visual Studio Code

Step 5
The highlighted things are installed on your machine.

Getting Started .Net Core with Visual Studio Code
That’s it. You have successfully installed .NET Core on your machine. To ensure if the SDK is successfully installed or not, open your command prompt and type the below command.
dotnet –version

If it is successfully Installed on your machine, you will get the following output for version 2.1.502.

 Getting Started .Net Core with Visual Studio Code

Creating Simple Console Application

Step 1
Open Visual Studio Code or command prompt on your machine.

Step 2
After opening the Command Prompt, change your working path using the cd command.

Step 3
Next, we are creating a simple console application using the below command.
/dotnet new console -o "MyFirstConsoleApplication"
Note - Here, MyFirstConsoleApplication is the project name 

After creating the console application, you will get the following output.

Getting Started .Net Core with Visual Studio Code
Step 4
Next, if we need to open the console application's source code on Visual Studio Code Editor, we can use the below command.
/code ./MyFirstConsoleApplication

 Getting Started .Net Core with Visual Studio Code
After hitting Enter, it automatically opens the project's source code in Visual Studio Code. 
Output Screen

Getting Started .Net Core with Visual Studio Code
Step 5
Next, we are running the application in terminal using the following command.
dotnet run 

Getting Started .Net Core with Visual Studio Code
Finally, we have successfully installed .NET Core and created a simple console application in .NET Core.