How to Install the “C #” extension in Visual Studio Code in Windows 10!!! – Basic Guide
1_The first requirement to work with the C # language is to have the “Dotnet” Framework installed on the system. To do this we initially verify in the Windows cmd to have it available, for this we press the keyboard shortcuts (R + Windows Key) and in the cmd we write the following command:
And as we will appreciate, we have not yet installed the “Dotnet” Framework and the Windows console confirms it.
2_This step can be optional, but in the final part when the installation verification is carried out it can be very useful. And it is to check that the command “C: \ Program Files \ dotnet \” or “% USERPROFILE% . dotnet \ tools” is not yet present in the Windows environment variables, specifically in the “environment” and “variables. user “respectively.
These screenshots show us that the variable “dotnet” is not set yet.
3_Then we open the Visual Studio Code, and we look in the extensions options or we press the shortcut (Ctrl + shift + x) and we will obtain the same result, we instantly write the C # extensions and preferably install the official version provided by Microsoft, to in this way avoid error and get all its profits.
4_Now, we just need to install the “Dotnet” framework mentioned above.
To do this, we now go to the Official Microsoft Website (link provided at the end) and choose the “dotnet-skd” in our case version 5, in this present year of 2021. However, it is possible that in later years with the new updates of the visual studio editor It requires an updated version of the skd, although the steps are basically the same and in case they changed we would update the publication.
P.D: Press the button to obtain the “dotnet” installer, additionally we are installing a 64-bit version of the program. And if the button does not work, I leave the direct link, just copy and paste it in the browser or click in the button.
5_Download the executable and proceed to install, the default configuration will be more than enough, wait for the process to finish and click finish.
6_Now what we have left is to demonstrate that the installation was successful and there was no error in its execution.
To do this, we return to the terminal with (R + Windows key) and type the following command:
or also the following instruction to display the version:
Any of the previous commands should show us the optionces that the established instruction brings by default. Otherwise, check the environment variables, as indicated below.
7_Check the environment variables and verify that it is found, it will record the installation path of “dotnet”
As you can see, the environment variables are set correctly, if they are empty, go to the “dotnet” installation path, which by default is in “Programs / File” and copy the path as shown in the image.
8_Now create a workspace in Visual Studio Code, and open the terminal in the editor.
9_You can create an empty Class in C # or just type the following command to validate the installation in the same way in VS Code. And write the following command, which is the same that we have been doing.
10_And as you can see, the statement set in the command terminal “Visual Studio Code” does not work, if this also happens to you and you wonder if everything done above is correct. The only thing we can mention is that everything was validly configured and installed.
However, for the changes to take effect, you only need to perform one last, simple step.
Restart the computer (PC) so that the previously verified environment variables are set correctly.
Restarting the computer. Please restart it.
11_Finally, after having restarted the computer, we proceed to enter the VS Code and try again with the same command.
And magically its works.
It shows us the same options as in the Windows terminal.
12_Now to start working in C # we will write the following command
C: \ Users \ User> dotnet new console
It creates a couple of directories for us and adds a default file called “Program.cs” which contains its respective class.
We can rename it, both to the file and to the same class.
13_We establish any instruction, in our case we change the message in the “WriteLine” method from “Console” to “Welcome to the Bytcode World”.
And we execute the file with the extension “.csproject”, which refers to the project and calls the main function.
P.D:We use the “Code Runner” extension to run the program. You can find this plugin in the same way in the VS Code extensions and install it.
And basically that would be the procedure to install and configure a work environment in C #.
Thank you in advance for your attention.