C# Beginners – Using Vs-Code is a guide to setting up and using Visual Studio Code for C# development on Windows and Linux. I hope to add Mac eventually; however, I do not own one. Beyond the initial installation, the extensions should be identical. VsCode is an entirely free lightweight IDE from Microsoft. Out of the box, its abilities are pretty limited. However, its strength is seen in the enormous selection of extensions available. It is not as good as Visual Studio or Rider, but it comes pretty close; it is free and runs on all operating systems. Even if VsCode isn’t your primary IDE for anything, it is an exceptionally useful tool in any developer’s toolbox.
Install VsCode – C# Beginners – Using Vs-Code
It is worth noting for Windows users that if you have not installed Visual Studio with the .net development tools first, then it will be necessary to install the .Net SDK.
Install Vs-Code Windows
Downloading Vs-Code For Windows
VsCode can be downloaded here.
After downloading the installer, run it and follow the prompts. There are some considerations during the installation. Firstly, the options to add Code to explorer are exceptionally useful.
After the installation finishes, VsCode can be found on the start menu.
Install Vs-Code Ubuntu (Linux)
A text version of this guide will return soon.
VsCode Extensions For C#
Adding a few extensions makes the experience of using C# in VsCode possible and pleasant. Find the plugin options as shown in the image below.
Most of them can be found by searching for C#, then the last by searching for ‘solution’. The list below is the ones I use and suggest for getting started.
- C# For Visual Studio Code (Essential)
- Auto-Ising for C#
- C# Extensions
- C# Namespace Autocompletion
- C# XML Documentation Comments
Creating A C# Solution – C# Beginners – Using Vs-Code
Running A Program – C# Beginners – Using Vs-Code
Video Version – Windows – C# Beginners – Using Vs-Code
Video Version – Ubuntu – C# Beginners – Using Vs-Code
Taking Input From the Console.
By default, VsC-de doesn’t allow you to take user input from the console. To achieve this, a few steps must be followed.
- Open the folder you will work in for the C# Solution.
- Save a VsCode Workspace;
The older version of VsCode will generate a folder called .vscode with a file inside called launch.json. However, newer versions require you to make this.
- Click on the Run Debug icon
- Click on the link to create the launch.json file.
- Open the launch.json file inside the .vscode folder.
Save the file and run the program. The effect is it now launches in a terminal that does support console input. This is not only true for C#. It is valid for all languages that use console input.
Video Version – Take Input From The Console
Related Articles – C# Beginners – Using VsCode
- C# Beginners Introduction
- C# Beginners – IDE Choice
- C# Beginners – Visual Studio
- C# Beginners – Using Rider
- C# Beginners – Start Coding
- C# Beginners Variables & Types
- C# Beginners – User Input
- C# Beginners – If Else Selection
- C# Beginners – Switch Statement
- C# Beginners – Try/Catch/Finally
- C# Beginners – Lists And Arrays
- C# Beginners – Loops