Using .NET Core in Visual Studio Code

.NET Core gives you a blazing fast and modular platform for creating server applications that run on Windows, Linux and Mac. Use Visual Studio Code with the C# extension to get a powerful editing experience with full support for C# IntelliSense (smart code completion) and debugging.

Getting Started

  1. Install .NET Core.
  2. Install the C# extension from the VS Code Marketplace.

Hello World

If you'd like to get started with a simple "Hello World" program on .NET Core, follow the steps below:

  1. Initialize a C# project:
  • Open the command prompt (or terminal).
  • Navigate to the folder where you'd like to create the C# project.
  • Type dotnet new.
  • This creates a Program.cs file in your folder with a simple "Hello World" program already written.
  1. Resolve the build assets by typing dotnet restore.

Tip: If you are using the MSBuild-based .NET Core Tools, a .csproj project file will be created instead of a project.json, but the dotnet commands remain the same. Read more.

  • Running restore pulls down the required packages declared in the project.json file.
  • You'll see a new project.lock.json file in your project folder.
  • This file contains information about your project's dependencies to make subsequent restores quicker.
  • There will be a notification that appears at the top of the window asking if you'd like to add the required assets to build and debug your project. Select Yes.
  1. Run the "Hello World" program by typing dotnet run.

Watch a video tutorial for further setup help on Windows, macOS, or Linux.

Tip: Continue exploring C# development: Debug with VS Code and .NET Core

Next Steps

  • Basic Editing - Learn about the powerful VS Code editor.
  • Code Navigation - Move quickly through your source code.
  • Working with C# - Learn about the great C# support you'll have when working on your .NET Core application.
  • Tasks - Running tasks with Gulp, Grunt and Jake. Showing Errors and Warnings
  • .NET Core Docs - Visit the .NET Core docs for more information on this powerful cross-platform development solution.