The Amazing C# Extension for VS Code
Tags: csharp, dotnet, vscode, productivity
Published: 2023-06-30 09:25:47

## Hi there 👋🏻
Microsoft has recently released a new Vs code extension, and you should definitely be excited about it!

If you're a C# developer, then you surely already know that Vs Code doesn't cut it for C# development, it just lacked too many things, and you always had to go back to the fully fledged Visual Studio that's heavily curated for C# development, well, not any more (**SORT OF**), but let's face it, we all love Vs Code, it's lightweight, very customizable, and just feels good, while the standard Visual Studio is for sure great, and is crammed with loads of useful features, it's still pretty heavy and sort of sluggish if your machine isn't a bearing one. 

However, with the newly added extension, C# development gets so much better with **Vs Code**, let's have a look at the new **C# Dev Kit**, released on the 6th of June 2023, it's still in preview, but it does bring plenty of good stuff with it.


![C# Dev Kit Extension](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oshok6nkvwczu5a7e2ng.png)

> The extension has auto download with it, that means some additional extensions will be downloaded along side the main package in order for it to work, like `IntelliCode for C# Dev Kit ` extension and the original C# extension that's needed for Vs Code in order to be able to write C# code.

Now, if we open a new instance of Vs Code, we'll see this:

![Create new .Net project button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2phxnd6iarre7bcj7cn.png)

Unlike before, no need to the use the CLI to create a new .Net project, the new package brings that feature to Vs Code, so, let's use it to create a demo console app, click the **Create .Net Project** and search for console app, like this:

![Creating a console project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymmip4hk1u6bb0rgzip8.png)

After selecting the template, you'll be prompted to choose a directory for your project, once you pick the directory, Vs Code will ask you to give a name for your new project, once you're done, the project will be created and opened for you.

The first thing you may notice, is the **packages restoring** command running in the terminal, standard Visual Studio did that automatically for us, while during Post C# Dev Kit Extension, this command had to be run manually. Well, it's automatic now, and it is our first new feature.

## 1: Automatic NuGet Packages Restoration
This process is necessary for .Net projects, restoring the packages and dependencies ensures all the required packages and tools are in fact available for the project to compile and execute, and as I said, this before had to be done manually by running the command `dotnet restore`, now with the extension, Vs Code does that automatically upon the creation of a new .Net project, and also after modifying the main project file and saving it, like adding references to new packages, when restoration is needed.
However, the package still doesn't offer a package manager with a Graphical User Interface **GUI** like standard VS does, but I believe that may be added in future releases of the extension.

## 2: The Famous Solution Explorer
If you've used the beefy Visual Studio, then you're familiar with the **Solution Explorer**. In Visual Studio, C# projects are organized within solutions, which offers a hierarchal view of your solution, a solution can contain various projects from **Class Libraries, Web Projects etc...**. Now in Vs Code, we have the solution explorer as well, which works exactly like it does in standard Visual Studio.

![The new vs code solution explorer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m89in5uly440jmwnl8cj.png)

Now it's much easier than before to add new projects to the solution, just hover over the solution, click the plus button and add a new .Net project to the solution, no need to run 2 commands to create the project and then bring it into the solution.

## 3: Ai Assisted Code
Ai, Ai, Ai, You have to see it lol
The **IntelliCode** extension we downloaded earlier brings some pretty useful auto code complete features to Vs Code, but let's be honest, it's not as good as the one in the standard Visual Studio, the **Windows** version to be more exact (Referencing Visual Studio for Mac here).


![Intellicode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3n299lpc7n0ixh06jcya.png)

If you see the grey text, then that's IntelliCode suggesting the completion of the whole line, you can simply press `TAB` to accept the suggestion.

You may also see  grey-text suggestions appearing with the **IntelliSense** menu, which allows you to accept **multi-token predictions**, like this:


![Multi Token IntelliCode Suggestions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ncyzyhkc53ne8viqqmye.png)

As you can see, IntelliCode is offering to complete the condition, I can accept just by hitting `TAB`.

## 4: Building and Running Solution/Project
You can with the extension installed, build and run your solution or a specific project by right clicking it, and clicking build, or going to the debug button and start debugging the project, or if you want, you can just press `F5` and the debugger will start its work.


And there you have it, that was a quick overview of the new C# Dev Kit Extension, of course there's more to it, you can have a look for yourself by visiting the extension's page in Vs Code, and there you'll see guiding links that can direct you to the official documentation of the extension, where you can read more about it and get to know the little details about everything which the contemporary kit brings to the beloved code editor.