Get started with VS Code using C# and .NET Core on Windows

This is a quick tutorial for getting started with C# in VS Code on Windows with .NET Core!



Hi, this is a video tutorial for

getting started with

Visual Studio Code,

a lightweight cross

platform way to write C#.

Let's get started.

First, go to your favorite

search engine and search for

Visual Studio Code,

code.visualstudio.com will

be one of the first results.

This tutorial's for

getting setup on Windows, but

we also have downloads for

Mac and Linux.

So click the exe and

click Yes to run, and

click through the installer.

For those of you who don't know,

Visual Studio Code is a lightweight

cross-platform source code editor

that supports multiple languages,

as well as debugging,

embedded Git control,

syntax highlighting, and more.

It's completely free and

open-source on GitHub.

Click Finish, and

it'll open up Visual Studio Code.

Go to the Extensions

tab on the left and

install the C# extension, it will

be one of the first suggestions.

You can also find a lot of

other cool extensions there.

Now that we have VS code,

we need .NET Core to compile our C#.

So go back to your browser and

type in .NET Core,

microsoft.com/net/core will

be one of the first results.

Since I'm not using Visual Studio,

I'm using Visual Studio Code,

all I need to do here is

download the .NET Core SDK.

I can find the .NET Core SDK

download on the Command Line tab.

So click the exe and click

through the .NET core installer.

This one installs super

quickly as well, and

you can actually use .NET Core with

any source code editor you want.

I chose VS Code because,

[LAUGH] I just like it a lot.

Now I am going to

initialize a .NET app.

You can find these instructions

on the Download page.

In the command prompt,

I'm navigating to the folder

I want my project to be in.

Now I'll type .net

new console -o MyApp.

This creates a basic console

app in a directory named MyApp.

Now I can type code period to open

my project in Visual Studio Code.

As you can see my csproj

has appeared here

right by my program.cs.

The first time I open

a C# file in VS code

the C# extension will start

loading OmniSharp in the debugger.

Now I can open the integrated

terminal by typing Ctrl backtick.

And I'll run .NET restore.

Pop ups will appear asking you yes

to download the required billet

assets and to restore.

Now I can type .NET run in

the terminal to run my app.

Cool, so let's make this a party and

initialize an asp.netcore app and

try it out.

I'll go back to my console and

type dotnet new mvc -au none

-o aspnetapp.

The -au none specifies

no authentication, and

the -o aspnetapp sets

the output directory.

So I'll open that in VS Code

by typing code period again.

And you can see the web

project template loaded.

That's my program.cs.

And there are those pop-ups again

to load build assets and restore.

So now I'll open up the terminal

with Ctrl+Backtick and

type .NET run.

Now that it's running, I can go to

my localhost 5000 in my browser and

view the web app that

I just initialized.

And there it is.

So that's the setup and

demo for a basic

model view controller ASP.NET app,

created in less than five minutes.

Thanks for watching!