Welcome folks today in this blog post we will be looking on how to setup c# in visual studio code and running the first program. All the steps of this tutorial is shown below.
Get Started
In order to get started you need to download the .NET 6 Framework or SDK
on windows machine so that we can create C# programs in command line
DOWNLOAD .NET 6 FRAMEWORK SDK HERE
And after downloading this sdk simply follow the instructions to install this sdk in the windows machine as shown below
After installation is complete you will get this above window. Simply now open the command line to cross check if the installation has taken place successfully or not as shown below
As you can see we have written the below command
dotnet
The command is successful. Now we have successfully installed the .NET 6 SDK
So now we just need to setup C# environment for visual studio code as shown below
Setting up C# in Visual Studio Code
Now for the setup you need to install the below visual studio code extensions which are shown below.
All these are C# Specific extensions for working smoothly in writing the c# programs and running them. Now we need to execute the below command to initialize a new C# Project
First of all inside the visual studio code you need to open a new terminal as shown below
And then we need to execute the below command as shown below
dotnet new console
This will create a new c#
project in the root directory as shown below
Now to run this Program.cs
c# hello world program on the console you need to execute the below command which is shown beloww
dotnet run