Working with C#

Installing C# support

C# language support is an optional install from the Marketplace. You can install it from within VS Code by searching for 'C#' in the Extensions view (Ctrl+Shift+X) or if you already have a project with C# files, VS Code will prompt you to install the extension as soon as you open a C# file.

Video Tutorial on Getting Started with C# in VS Code with .NET Core

In addition to the Microsoft C# extension, the community has produced other extensions.

 

Roslyn and OmniSharp

Visual Studio Code uses the power of Roslyn and OmniSharp to offer an enhanced C# experience. We offer support for:

  • .NET Core projects
  • MSBuild projects
  • C# scripts (CSX)

On startup the best matching projects are loaded automatically but you can also choose your projects manually. The status bar will show what projects have been loaded and also allows you to select a different set of projects. To do so, click on the status bar projects item and select Change projects…. In the image below a single project has been picked up:

 

The available options include:

  • Selecting a project.json file will open a .NET Core project and VS Code will load that project plus the referenced projects.
  • Selecting a *.sln file opens a MSBuild-project. It will load the referenced *.csproj projects and sibling or descendant project.json files but no other project files that are referenced from the solution file.
  • Selecting a folder will make VS Code scan for *.sln, project.json and *.csx files (C# scripts) and VS Code will attempt to load them all.

Once the project is loaded the enhanced experiences light up...

 

 

 

 

 

 

Using .NET Core in Visual Studio Code

 Note: VS Code does not support debugging applications running on the Desktop .NET Framework.

Due to this focus, many standard C# project types are not recognized by VS Code.

An example of a non-supported project type is an ASP.NET MVC Application (though ASP.NET Core is supported).

In these cases, if you want to have a lightweight tool to edit a file - VS Code has you covered.

If you want the best possible experience for those projects and development on Windows in general, we recommend you use Visual Studio Community.