How to create and run .NET Core Application using any IDE Visual Studio Code

Updated on: May 26, 2021

Almost all of the users create .NET Core application in Visual Studio, but now, .NET Core applications can be created from any editor even we can create it using Notepad and run it from .NET CLI commands. In this article, we will be showing you how to create .NET Core application in Visual Studio Code and run it from Visual Studio Code:

Required tools to be downloaded and installed on the machine before development of .NET Core application:

1. .NET Core SDK

2. Any editor like Visual Studio, Visual Studio Code or Notepad 

Steps to begin with creation of .NET Core application:

Step 1: Test whether .NET Core is installed on the machine with the following command which can be run on the Command Prompt of the machine: 

dotnet --version

If it gives error like "'dotnet' is not recognized as an internal or external command, operable program or batch file.", then you should confirm whether .NET Core SDK is installed or not, if not, install it from .NET Core SDK

Step 2: Now, create the .NET Core Console / Web Api / Blazor app with the following command:

To create .NET Core Console app run following command:

dotnet new console -o ConsoleTestApp1

To create .NET Core Web Api App run following command:

dotnet new webapi -o WebApiTestApp1

To create .NET Core Mvc App run following command:

dotnet new mvc -o MvcTestApp1

To create .NET Core Blazor Server app run following command:

dotnet new blazorserver -o BlazorTestApp1

Step 2: Now, open the project in any editor, in this example, we will be opening the code using Visual Studio Code with following command:

code .

This command will open the BlazorTestApp1 project in Visual Studio Code and the project structure in Visual Studio Code will look like:

Step 3: Now, build the project from command prompt or from Visual Studio Code (From menu "View => Integrated Terminal" option):

dotnet build


Step 4: Once the project is successfully built without any errors, you can run the project with following command:

dotnet run


The above command should run the project, now we opened the URL https://localhost:5001/ on the browser, it is showing following output:

You can try creating .NET core application using above steps. Because .NET Core is cross platform, you can create .NET Core apps on Windows, Linux, Mac machines.