If you’re anything like me, meaning you normally use full Visual Studio and the built-in App templates whenever possible and limit your VS Code usage to developing Single Page Apps or editing some JavaScript files.

However, if you’re anything like me, you did not consider the fact that Microsoft is retiring Visual Studio for Mac as any kind of good news. Ok, the thing was far from perfect but the fact that Microsoft considers what is a text editor with Plugin support an adequate replacement for an IDE.

Well, being a .NET Developer on a Mac is naturally not the only use-case for wanting to use VS Code instead of VS Community Edition.

This post intends to show how we can create an ASP.NET Core MVC App using Visual Studio Code, so it will be a good start.

What you will need:

After you install Visual Studio Code and the latest .NET, you should install the C# Dev Kit for VS Code to make your life easier. It’s just way more convenient. So, let’s first install that as well.

You can install it from Visual Studio Code as well by opening the Extensions List – (View -> Extensions)

After you install it, you should see something similar to the following window when you select the explorer:

Visual Studio Code after installing the C# Dev Kit Extension
Visual Studio Code – Explorer- after installing the C# Dev Kit Extension

As you can omagine, you can just click on the “Create .NET Project” button to start the process. The Command Palette will open with the various .NET Project types:

.NET Project Templates in Visual Studio Code

You can bring up the same Template List from the Welcome Screen as well, by simply going to the Command Palette (View -> Command Palette) and searching for .NET – You should be able to see something similar to “.NET: New Project…

Anyway, ,after you select the “ASP.NET Core Web App Model-View-Controller” it will ask you to specify a directory where to create the project and once you select it and enter the Solution Name when promptes, the project will be created.

ASP.NET Core MVC Project in VS Code

To run the Project, seƶect the Build and Run Configuration on the side. Over there you can create the Configuration by simply selecting the “Show all automatic debug configurations…”

After you create the configuration, you should be able to start debugging.

If you get the error that WebApplication cannot be found, you might not have installed the latest .NET SDK. After you install it, your best bet is to restart the VS Code.

Regarding the development, you can then use the Visual Studio Code to create new classes and essentially develop almost as good as in Visual Studio (haha).

I hope you have enjoyed this tiny tutorial on how to use Visual Studio Code to create and edit, build and debug ASP.NET Core Projects.