vs code

Visual Studio Code for C#

Microsoft and most people suggest you use Microsoft Visual Studio IDE for C# development. Unfortunately there are a few problems with this.

  • It is unavailable on Linux.
  • There is a paid and free version so you are limited on features.
  • It is very resource consuming.

For the reasons listed above a lot of developers look for alternatives and I think the best is also from Microsoft, Visual Studio Code. Here I will say why it is a great alternative and how to set it up for C# development.

Installation of .NET / dotnet

Of course you need to first install the editor which you can do from here: https://code.visualstudio.com/

Install dotnet

Before setting this up you will need the .NET SDK (currently version 7).

Here is the download link: https://dotnet.microsoft.com/en-us/download/dotnet/7.0

Don’t worry, it is possible to even install this on Linux. I suggest using the “scripted install” https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install

I did both of the above

Here I just did the last command, this installs the SDK and runtime.

To make sure this works, go to your terminal and execute dotnet –info, if you see a wall of text you have succeeded!

Extensions

Default vs code doesn’t have good support for C# and dotnet but this can be fixed by installing these two extension.

C# from Microsoft

This gives quality of life features like syntax highlighting, intellisense etc.

If you click on the settings cog and go to settings you can enable the following to make the experience even better.

  • Enable async completion
  • Enable import completion
  • Organise imports on format

These will definitely help you avoid bugs related to imports.

Another extension I recommend to really give useful IDE features is C# Extensions from JosKreativ.

This helps you do things like create new .NET related files based on templates.

NuGet Gallery

This extension gives you a GUI for browsing and installing NuGet packages (make sure you pick user pcislo, there is another one with the same icon).

After install press ctrl + shift + p (for Mac replace ctrl with cmd), search NuGet and click NuGet: Open NuGet Gallery. You will then see this.

Now we have more IDE features in Vs code that is cross platform and not a resource hog like Visual studio.

Hope this helped :).


Posted

in

by

Tags:

Comments

Leave a Reply

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