Create an ASP.NET Core Application Using Visual Studio Code

ASP.NET Core with Visual Studio Code

ASP.NET Core is a framework for building Web and cloud applications. It is a fully open source and cross-platform framework available on Windows, Linux and Mac. ASP.NET Core Applications run on .NET Core or .NET framework. ASP.NET core is an open source available at Github.

GitHub URL for ASP.NET Core - https://github.com/aspnet/home

Features of ASP.NET Core

ASP.NET Core has built in Dependency Injection.

  • Open Source Framework.
  • Cross-Platform Framework.
  • .NET Core supports side by side versioning.
  • Can be hosted on IIS or self-hosted on our process.
  • Integration of modular client side frameworks.

Creating your First .NET core Demo Application on Visual Studio Code

First, download .NET Core Framework and Visual Studio Code.

Download and install the two links given above.

  • Open Visual Studio Code
You will get the screen, as shown below.

After opening the first window, click on the extension tab on the right side.

From here, a panel will be opened to install C# for Visual Studio Code. Click on install to install C# for Visual Studio Code.

After installing, you will get the screen, as shown below.

Now, you have installed C# language, so as to work on Visual Studio Code.

After installing C#, click on the first tab on the right side of the menu file given below. This is an Explorer. Click here to explore the folders for your C# Application or create a folder for your current application. You have to select the folder for creating your application. When you click on the Explorer, you will get a screen, as shown below.

 

From here, you can browse to the folder or browse to the location and create a folder, as I have created a folder named “NewDemo” and select the folder. Click select folder button after creating or selecting the folder, where you want to create your application.



Now, you will get the folder name as root directory of your application. Now, you have to create a project in this folder that can be created , using certain commands, as I am describing step by step. After clicking, select folder button, a new screen, as shown below will be opened for you.



Now, you can see in the screen given below, icons to create files, folder or refresh the folder.



Now, we can create the project here.

Click Ctrl + ` on your keyboard. This will open a command prompt, as shown below to write the commands.

Here, you can write the commands to create your first project.

Type the command in the opened command prompt. 
  1. dotnet new
You will get the screen given below with the created project files. Your project is created now.



To restore JSON and all other files, type the command given below.
  1. dotnet restore

You will get all the project files created below.

Here, your project is created.

Open your program.cs file. You will get a demo program “hello world” written in it.



Build the project and run it by pressing F5.



See the screen given below. Here, you can find all watches, if you want to watch your variable values at any time, while debugging,



After the full process of debugging, you will get the result, as you wanted it to print.



Now, if you open the project folder, you will get all the files created there.



This was the process to create a console application. You can also create a web project by following the command  Dotnet new –t web instead of dotnet new.

This was the basic console application creation process in .NET Core. Follow the steps to create your own applications. Please provide your valuable feedback.