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

Download this episode

Download Video

Download captions

Download Captions

Description

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

 

--------

Transcript

Hi, this is a video tutorial to get

started with Visual Studio code

on your Mac with .NET Core, wait,

something doesn't feel right.

Much better.

First, go to your favorite search

engine and type in Visual Studio

code, one of the first results

will be code.visualstudio.com, and

it'll bring you automatically

to the Mac download.

And this installs really quickly,

because Visual Studio code is

a lightweight source code editor,

it's much different from Visual

Studio, which is the fully featured,

integrated development environment,

but with .NET Core and

the C Sharp extension,

VS code can do some really cool

debugging stuff with C Sharp.

All you need to do is go over to

the Extensions tab on the left,

click it and

install the C Sharp extension,

it'll be one of

the first suggestions.

Now that you have Visual Studio

code, you need .NET Core to compile

your C Sharp, so go back to your

browser and type in .NET Core,

one of the first results will

be Microsoft.com/net/core.

To install it on a Mac, the easiest

way is by using HomeBrew,

if you don't have it installed,

it's very easy to get, just copy and

paste the HomeBrew install command

from their main website into your

terminal.

And I'm going to be speeding

up these installs slightly,

because I wanna give a tour,

and not waste anyone's time.

Now I can run brew update and

brew install openssl,

because we'll also need openssl, and

I'll run the next few commands here,

which make a directory and

make your symbolic links.

Next click Download .NET Core SDK,

go ahead and

click on that download and click

through the .NET Core installer.

Once the install is complete, I'll

take you through the next commands

on our install page, which create

a basic .NET Core console app,

I'll speed this up a little bit.

There we go, so I'll navigate to my

Documents folder at the terminal.

And type dotnet new console -o

hwapp to initialize my project.

Here I'm using the -o to specify

the output directory as hwapp,

the hw standing for hello, world.

Now I can use the .NET commands

to run .NET restore and

.NET run from the command line,

.NET restore restores my project

dependencies using NuGet.

Now let's open Visual Studio codes

so we can edit and debug our

C Sharp, go to the file tab on

the left and click Open Folder,

I'll open the hwapp folder that I

just created from the command line.

As you can see, I have a csproj

loaded here next to my program .CS

file, pop ups will appear asking you

to yes load the build assets and

restore your project.

Now, let's debug our app,

click on the Debug tab on the left,

it's the one with a little bug

with a line crossing it out.

Now, you can hit the green debug

arrow at the top left of the Debug

tab, you can also drop a break point

and hit Debug again, and you can see

the local variables loaded on

the left, you can also check those

variables in the Debug console by

typing them, and there's args.

Now I'll hit continue

to complete debugging,

so that's your first .NET

Core app running on your Mac.

Thanks for watching.

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    Add Your 2 Cents