C# Beginners – Using Vs-Code

Introduction

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.

VsCode download image
VsCode download image

Installer Options

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.

VsCode Install Options
VsCode Install Options
VisualStudio Code Start Menu
VisualStudio Code Start Menu

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.

VsCodeExtensions
VsCodeExtensions

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
  • Vscode-solution-explorer

Creating A C# Solution – C# Beginners – Using Vs-Code

VsCode Create Solution
VsCode Create Solution
Vs-Code add new project to c# solution
Vs-Code add new project to c# solution
VsCode c# ConsoleApp Setup and ready
VsCode c# ConsoleApp Setup and ready

Running A Program – C# Beginners – Using Vs-Code

VsCode C# HelloWorld program
VsCode C# HelloWorld program

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.

  1. Open the folder you will work in for the C# Solution.
  2. 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.

VsCode Create launch.json
VsCode Create launch.json
  1. Click on the Run Debug icon
  2. Click on the link to create the launch.json file.
  3. Open the launch.json file inside the .vscode folder.
vscode edit launch.json
vscode edit launch.json

Change

"console": "internalConsole",

To

"console": "integratedTerminal",

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

Related Post

5 thoughts on “C# Beginners – Using Vs-Code

Leave a Reply

Your email address will not be published. Required fields are marked *