Content Archived

This content is no longer current. Our recommendation for up to date content: https://channel9.msdn.com/Blogs/dotnet/Get-started-VSCode-Csharp-NET-Core-Windows

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

Download this episode

Download Video

Download captions

Download Captions

Description

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

Embed

Format

Available formats for this video:

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

    The Discussion

    • User profile image
      Derrick Smtih

      Excellent introduction for VS Code with C#!

    • User profile image
      nheadlam

      Very neat, to the point, and fun.  Excellent!

    • User profile image
      Tokenaton

      Fast and furious coding :)

      Very well !!!

    • User profile image
      The Wizard of Oz

      I like this girl, I would like to watch more videos like this, and know more about VS code.

    • User profile image
      jvs_ca

      Very nice video! More please.

       

    • User profile image
      GammaMonkey

      Rockstar. Please post a git/GitHub demo using VSC

    • User profile image
      IPowerPanda

      Excellent. Please create more of those!

      Next time please spend a couple of seconds explaining in more detailing what is happening.

      e.g when you execute "dotnet restore" - what exactly is happening here? You skip a bit over the details for the sake of brevity.

    • User profile image
      kendrahavens

      @GammaMonkey: A git demo with VSC is a great idea. I'll put that on my list.

       

      @The Wizard of Oz: I like this wizard. Thanks for watching!

       

      *@IPowerPanda: "dotnet restore" links required build assets to you new C# project and creates the all-powerful project.json file. The project.json file is what VS Code uses to recognize that this folder has a project in it. You can get a better idea of what data it stores on your project here. Let me know if that helps. :)

      *Edit for @IPowerPanda: Actually I went back to my video and my first answer is not accurate. (Sorry!) "dotnet restore" actually creates the project.lock.json. There is an awesome explanation of this on stackoverflow here.

    • User profile image
      songpl

      Very well! More please.

    • User profile image
      SteveRichter

      any support for WPF or XAML ?

       

    • User profile image
      Mexxanit

      Nice, thank you.

    • User profile image
      xamiell

      Very nice video!

    • User profile image
      kendrahavens

      @SteveRichter: If you are only concerned with windows environments, you can actually target .NET Framework in VSCode which would have XAML and WPF support. This is super useful for folks who want to quickly launch projects and don't need all the features in Visual Studio for what they are working on and just want something light-weight to work with on a windows machine. My tutorial uses .NET Core to compile and that does not support WPF nor XAML cross-platfom.

      Porting System.XAML to .NET Core is definitely a popular request! We have an open issue on GitHub that details the discussion. Basically, the community really wants it, but the team is first trying to implement a set of standard libraries in .NET Core. See out roadmap here.

      Also thanks everyone for the positive feedback! I am working on a Mac set-up tutorial next. :)

    • User profile image
      Nikolai​Kekish

      Hi,

      all is ok. but.

      I repeated your steps on linux (ubuntu 16.04) and found that there is no

      predefined right for c# launch,json file. may you please describe how to do it ? or may be send sample, please or send link how to learn to do such files for c# right ?

       

    • User profile image
      Nikolai​Kekish

      @NikolaiKekish: Looks like that I found answer.

      "If you open the folder containing your project.json, the C# extension can automatically generate these files for you. When you open a project and the C# extension is installed, you should see the following prompt in VS Code:"

      from https://github.com/gregg-miskelly/omnisharp-vscode/blob/daily-build-docs/debugger.md

       

       

    • User profile image
      kendrahavens

      @NikolaiKekish:Hey there! I am so sorry. I should have made it clearer that this tutorial was only for a windows environment. I just had a co-worker point this out to me too, so you are not alone. I plan on making different tutorials for mac and linux soon because they each will look a bit different.

      For now, this may help:

      The page on github that you found is for using the daily builds. I wouldn't recommend this for a beginner tutorial, but yes, the project.json files are automatically generated.

      Generally, ubuntu 16.04 (for @NikolaiKekish) should download VS Code from the .deb file here. Then follow the steps to install the .NET SDK here. Download the C# extension in the same way I showed you in the tutorial by clicking on the extensions tab and selecting the C# extension in VS Code. The rest of the tutorial should be basically the same from there.

      ...

      For mac users having similar problems:

      Mac users need Homebrew and OpenSSL installed (directions here) in order to install the .NET SDK. I plan on walking through those steps in my next video. Also, the Console.Beep library that I call is not available on mac, fyi, so I'll use a different example to demonstrate intellisense and omnisharp are working.

    • User profile image
      epion

      git/GitHub for VS Code examples PLEEEASE!!!

    • User profile image
      marcin

      Getting an error - "launch: launch.json must be configured. Change 'program' to the executable file that you would like to debug."

      In this example where and what path should be in launch.json

    • User profile image
      Nikolai​Kekish

      @kendrahavens: many thanks. I tested .net core on linux. it works fine.

      I found out that there is no mysql support (only in beta) so it is not good for me.

      Maybe do you know right way to use mysql from .net core?

    • User profile image
      kendrahavens

      @marcin: Hmm, I'm trying to understand why that error would come up. After omnisharp and the debugger finish installing a pop-up at the top appears to add required build assets. If you click "yes" when the required build assets pop-up appears the launch.json file would be configured automatically. Could you comment some screenshots? I got the same error when I clicked "no" when the prompt to add required build assets appeared. That might be your problem. I do this at 3:17 in my video. Looks like you will need to add it manually if you clicked no. Find help for that here. (I would recommend just starting a new project and hitting "Yes" and then copying over your code.) Let me know if that helps. :)

       

      @NikolaiKekish: Good question! This is the stack overflow tracking this topic. This is a walk-through of getting set up. I haven't tried it out myself, but I hope this helps. :)

       

       

    • User profile image
      gjuro

      what a cute expert... and she is also short, clear and precise... let her do more presentations...

      I would like to see how to use win10-built-in-ubuntu for development directly from visual studio (on windows), both in C# and C++ (and maybe even VB.NET)...

    • User profile image
      George

      I did enjoy the video and learned from it. Thanks.

    • User profile image
      Marcin​Sulecki
      Excellent! I was looking for something like this.
    • User profile image
      Deactivated User

      Comment removed at user's request.

    • User profile image
      jrhewetson

      That was excellent Kendra, the enthusiasm was beeping refreshing.

    • User profile image
      kendrahavens

      I posted the next tutorial for mac users that goes through this same process just on mac Sierra.

       

       

    • User profile image
      adrianowm

      Thanks you, I from Ecuador....and you are is a great teacher..... This class was excellent...lady Kendra ;)

    • User profile image
      hyousef

      Really Simple and Straight, awaiting for more regarding the Net Core.

      are you in MicroSoft since a month only, or just started taking care of the Net Core since a month, whatever the case, wish you all the best. 

      Can you pls add to you list preparing a one about publishing/distributing the app without using a paid service (i.e. without using Azure).

      Thanks

    • User profile image
      MiffyPapa

      I made a Chinese version, please visit here
      http://i.youku.com/i/UMzg0NDg0ODEyMA==/videos

    • User profile image
      kendrahavens

      @MiffyPapa:That's awesome!!!

       

      @hyousef: I just graduated in May. If you want to hear my life story I did a GALS episode that will be posted Friday! But I like Azure! Did you see Scott Hanselman's video?!

    • User profile image
      DotNETHeroes

      Lovely and light introduction, thank you :)

    • User profile image
      VinaDev

      Great!!! 

    • User profile image
      Anj

      Hi can you do a tutorial for a hello world with VS Code and ASP.Net Web Pages. I would like to see how you get the debugging setup with razor code. I've tried a few times from scratch but have only been able to copy larger ASP.net core examples and then run the .cshtml files in that but I dont want to use the MVC model. I did it using Visual Studio 2015 Community but I would like to do it on my Linux

      Thanks Andrew

      BTW great job on the vids

    • User profile image
      M0J0R1S1NG

      I am going to egregiously +1 the previous posters request for VS Code and ASP.NET web Pages debuggin

    • User profile image
      DihoKing

      Thnks so much, Finally i can write a simple app in VS Code :S

       

    • User profile image
      kendrahavens

      @Anj:@DihoKing: ASP.NET Web Pages is on my list! I might not get to it for a few weeks. So many videos ideas so little time. :D

    • User profile image
      Jerry

      Excellent! Start to finish... that's perfect. And a Classic "Hello World!"

    • User profile image
      pouria


      thanks so much,but when I want to run my first project, in terminal
      here is the error:
      C:\Users\c#\code\HelloWorld>dotnet new
      Access to the path 'C:\Users\c#\code\HelloWorld\Program.cs' is denied.

    • User profile image
      pouria

      please help me kendra

    • User profile image
      gabrielqv

      @pouria:Have you checked using different folders? it looks like some administrator privileges aren't working, folders outside users, running as administrator or checking your Microsoft user could fix the problem? i have heard of  strange locked folders in windows before

    • User profile image
      kendrahavens

      @pouria:Sorry, I didn't get back to you sooner! As @gabrielqv: said, it sounds like a folder permissions problem. I would first open up the command prompt in "Run as Administrator" and try to run "dotnet new" again. That often solves file permission problems. If that doesn't work I would google "access to the path is denied" for tutorials on how to check and change the permissions on my folders. Let me know if this helps!

    • User profile image
      Bill

      Great video. It looks like this is the new thing that we now need to learn. I was told that this will replace WPF. Is that right?

    • User profile image
      prilldev

      Awesome intro video... loved the "Holy BEEP!" finale. :)

    • User profile image
      soraco

      Excellent start! It would be great to have a tutorial that shows how to connect a .NET Core class to a legacy ASP.NET web service.

      We want to move to .NET Core in phases and the client is obviously the first step but our server is still running an ASP.NET web service (SOAP).

    • User profile image
      Mazndzukic

      Hi.
      When do you publish a new video but, instead of showing steps of a regular VSCode and NetCore installation, why not tty with the VSCode portable version -the IDe packaged in a zip folder- together with the zip package version of the .net Core version? In other words, no the executable packages, intead use the .zip packages distribution?

    • User profile image
      gabrielqv

      Hi @kendrahavens have you tried installing visual studio 2017? I am in a school project and looking for a lightweight solution for c# programming, was happy with code, but some people (incorrectly) told me  that I needed to do some form apps so I needed visual studio,  2015 worked fine before, but after installing code and seeing good results with only 10% percent of the 9gigs installation I tried my luck with Visual c# sharp 2010 (the last version that seems to fit in 1 GB!!) however errors arose even only when starting the project, saying that the 4.0  framework couldn't be found (but it was installed !)..

      As VS2015 worked ok and I heard there was a lightweight 2017 version with a 700mbs install I tried my luck with the Release candidate, but nope, 700mb are only for a basic text editor I can't even run a console app, for that it downloads an extra 3 gigs... so taking into account data caps (no offline install for 2017) and that I can't work anymore with visual code it all got pretty annoying :(

       code works if I use " dotnet run "  but I can't make it work with the play button  as before so no debugging at all.
      does frameworks interfere that bad with each other? or is this a problem with 2017? csproj ?  sorry for the rant, I hope things get sorted and I don't spam this video box

    • User profile image
      arunphilip

      A good video that quickly got me up and running very quickly with C# in Visual Studio Code.

      At first, I was thinking to myself "A beep for an example? Really?" but the presenter integrated it into her presentation hilariously!

    • User profile image
      kendrahavens

      @Bill: No. .NET Core is a great solution for people who want to build cross-platform apps. WPF and the .NET Framework are still awesome options for windows development.

       

      @soraco: That's great! I'll see if I can do that tutorial or maybe check with the ASP.NET monsters to see if they've already covered something similar. Is migrating from ASP.NET to ASP.NET Core the basic challenge here?

       

      @Mazndzukic:That's definitely an option. I, personally, like this way because users are more likely to understand they are two different components that will have different releases at different times. I see that as important from a developer standpoint so you know which one to file bugs on or which one to troubleshoot when something is acting oddly. They each have different documentation associated with them as well. I'll keep it in mind though! Easier installs is always nice! :)

      @gabrielqv: That does sound frustrating. :S  So, which environment are you working in now Visual Studio or Visual Studio Code?The frameworks should not interfere with each other. Sometimes multiple installs of different Visual Studio versions can cause problems. However, Visual Studio and Visual Studio Code can be installed alongside each other with no issue. Are you still working with a form app? (Sorry for the delayed reply!)

       

      Thanks, everyone still reading these comments for the positive replies!

       

    • User profile image
      Ajay

      Awesome Video...Eager to explore more in VS Code. Could you please add video for Web application development samples.

    • User profile image
      Cristian

      Hello Kendra,

      Many thanks for such a friendly and straight to the point getting started video.

      I've encountered a problem while trying to debug the .cs script. During the debugging command I've got the following error:

      ERROR: Unable to start debugging. Unexpected CLRDBG output from command "-exec-run". Only 64-bit processes can be debugged.
      The program 'c:\Educational\Projects\C#\bin\Debug\netcoreapp1.0\C#.dll' has exited with code 42 (0x0000002a).

      I am running the Visual Studio Code over windows 8.1 and I've installed .Net Core SDK with x86 option. Are you aware about similar debugging issues?

      Thank you again,
      Cris

    • User profile image
      Han_​Anonymous

      Beautiful video. Beautiful teacher. Simply perfect!

    • User profile image
      kendrahavens

      @Cristian: Interesting. Does the command "dotnet run" work? 

    • User profile image
      gishu

      Microsoft needs more Kendra!

      concise video Holy BEEEEEPPP!. Loved the ending. Nice job - long time C# coder, was missing it on OSX. Not any more :)

    • User profile image
      Cristian

      @kendrahavens: Of course, the command works all right.

    • User profile image
      EnigmaRaptor

      Hope that you also had a video about asp.net core mvc showing on how to scaffold using a controller with entity framework in visual studio code. and also by showing us how to create a full blown web application like a blog using the asp.net core MVC using just only VS code. nice video by the way.:)

       

    • User profile image
      Danilo

      I just love your videos and the way you teach us, keep up this awesome job!! Thank you so much!

    • User profile image
      Stan Denman

      I cannot get past the dotnet restore command. I get an error saying that the access to the path is denied! Any advice?

    • User profile image
      aquakool2003

      I think the webpage for .Net Core has changed since your original video.
      1. Download Visual Studio 2015
      second paragraph does not mention .Net Core SDK

      I clicked on the "Command Line/Other" tab. I found the
      "Install .NET Core SDK" there and downloaded it.

      Everything else went just like the video except when I clicked program.cs. That is when Omnisharp and I think the .Net Debugger
      were downloaded and the Terminal CMD.EXE box switched to
      Output.
      I thought I installed OmniSharp C# extensions when I started VS Code.
      So do Why did it need to be installed again?

      I switched back to terminal using Control-`(backtick) and ran program.cs. It ran with no problem.
      Also at the top of VS Code window below the menu bar there is a line saying
      Warn Required assets to build and debug are missing from 'HELLOWORLD'.Add them? Don't Ask Again | Not Now |Yes

      I chose Yes and below HELLOWORLD I have three(3) directories
      .vscode, bin, obj

      I am using VS Code 1.8.1

      By the way I confused setting a breakpoint when you mentioned hitting F5 in your video.
      For laptop users you may have to hold down the fn key when you hit F5. Dohhhh.

    • User profile image
      kayweng

      Great for beginner to explore .net core and vs code :)

    • User profile image
      aquakool2003

      ooops I meant:
      By the way I confused setting a breakpoint with Debugging when you mentioned hitting F5 in your video.
      For laptop users you may have to hold down the fn key when you hit F5. Dohhhh.

      Let me squeeze one last question in:
      Can you install VS Code and Visual Studio Community on the same machine?
      I installed VS Code in order to learn how to install C# support in VS Code.
      Now I am ready to try writing C# code to write sharepoint CSOM- I think that means Client Service Object Model- code in C# with Visual Studio Community edition.
      Thank you

    • User profile image
      Sudherson Vetrichelvan

      Excellent, exactly what I was looking for.

    • User profile image
      Neal Noble

      Nice video series. MS has come a long ways since I was an FTE. I Noticed that in the video the browser was Chrome and the default search engine was Google. While I was at MS I always argued for letting the best app\tool win (I also used Chrome\Google), and if MS product teams needed to step up to beat the competitors, then so be it. In the past, including competitor software in public facing videos required upper management approval. :)

    • User profile image
      Vytautas

      Hello, I was actually scratching my head on how to actually start this. One thing though. I have tried to go step by step on the project, however I can't seem to get to the debugging part. I never get the "Required assets to build and debug are missing from your project" and when I try to go to debug, I need to set it up manually.

    • User profile image
      Ole

      Kendra, I think I am in love with you and VSCode

    • User profile image
      srikanth potla

      Hello Kendra,

      Many thanks for such a friendly and straight to the point getting started video.

      I've encountered a problem while trying to debug the .cs script. During the debugging command I've got the following error:

      ERROR: Unable to start debugging. Unexpected CLRDBG output from command "-exec-run". Only 64-bit processes can be debugged.
      The program 'c:\Educational\Projects\C#\bin\Debug\netcoreapp1.0\C#.dll' has exited with code 42 (0x0000002a).

      I am successfully compiled and executed the code with (dotnet run command). This problem is only with DEBUG option.

      I am running the Visual Studio Code over windows 8.1 and I've installed .Net Core SDK with x86 option first and after seeing this error, i observed that my machine is x64 and the i install SDK fro x64, still i am getting the same error. Could you please help me with this.

      Thank you again,
      Srikanth Potla.

    • User profile image
      srikanth potla

      Hello Kendra,

      Thanks for the video, the above debugger issue got fixed for me. I just uninstalled VS Code and other sdk installers. And started freshly with VS Code installation and installed SDK for x64 bit. It started working for me this time.

      This will be helpful for others who are facing the same issue.

      Thanks,
      Srikanth Potla.

    • User profile image
      kendrahavens

      @Cristian: Sorry it took me longer to get back to you! I was enjoying the Holidays. Looks like you aren't the only one having this problem on 8.1. It's an open issue on the C# extension. It also looks like @srikanth potla: had the same problem. Maybe try his solution.

      @srikanth potla: I'm glad it worked out!

       

      @Stan Denman: Sorry for the late response! Try running terminal in Administrator mode if you are still having this problem. If that doesn't work it looks like there is an open issue related to this, though you'd have to verify if the problem is similar.

       

      @aquakool2003: Thank you so much for the feedback! :) It is so hard to keep these up-to-date. I'll keep your comments in mind for the next videos. Especially about the F5 confusion. The C# extension downloads the intellisense and opening the actual .cs file loads the OmniSharp debugging capability. You can totally install VSCode and VS side-by-side. I highly recommend it!

       

      @Neal Noble: Yep! Life its quite different. :D

      @Vytautas: That's strange. If the pop up does not appear I suggest initializing a new project and opening the .cs file. It should appear then. You can copy your code into the new project if that works. Let me know if that works.

       

       

       

       

       

    • User profile image
      Mohmmad​Houtary
      Hi, I created a project c sharp, i write code to enter a text value, but showed me the problem while the value entry please help
      The error message and the image in the following link
       
      The error message in the image is "Unable to perform this action because the process is running.
      "
      Also when you turn off the program shows : "The program 'c:\Users\mhd45\Documents\TowProg\bin\Debug\netcoreapp1.1\TowProg.dll' has exited with code -1 (0xffffffff). "
       

      Link : picture

         public static void Main(string[] args)
              {
                  Console.WriteLine("ُEnter Youre Name : ");
                  String name = Console.ReadLine();
                  Console.Write("Hello Mr : " + name);
                  Console.ReadKey();
              }

    • User profile image
      Luis Samano

      I've a problem.

      Microsoft Windows [Versión 10.0.14393]
      (c) 2016 Microsoft Corporation. Todos los derechos reservados.

      C:\Users\Samano Cedillo\Documents\Visual Studio 2015\Projects\Hello>dotnet new
      "dotnet" no se reconoce como un comando interno o externo,
      programa o archivo por lotes ejecutable.


      Please help me,
      Thank you.

    • User profile image
      JNags

      Looking for tutorial on creating a Web service using vs code and c#. Great info here,  thanks!

    • User profile image
      raphaelcrv2

      Wow y are very lovable! very nice tutorial tks;

      Visual Studio Code S2

    • User profile image
      hardik94

      @kendrahavens everytime when i have to create a new program should i follow same procedure and can i have more than one programs in same folder?

      Thank you in advance. 

    • User profile image
      KIN

      Good as using Chrome instead of IE/Edge

    • User profile image
      redstrike

      Best getting started video ever! I really like Kendra's introduction <3
      Just registered a channel9 account for this comment :)

    • User profile image
      Agung Kurniawan

      hi miss Kendra. Nice tutorial.
      may i ask.
      when i using System.Windows.Forms, it is not found. And give me error "are you missing assembly?"
      i search in internet that i must add dependency on project.json but i don't know the proper way to do that.
      hope you reply this. thanks. Sorry for bad english

    • User profile image
      YingHuiThe

      At 2:40 you mention "back tick" or "command prompt",
      1) what is a tick do you mean '\'?
      2) have clicked in the area that you mouse was at when the display changed and cant get it to happen, and cant see option on any of the menu bar items.
      3) have looked through the Show All Commands, cant see the option there
      Best
      Ying-Hui

    • User profile image
      farshid​Ahmadi

      I really like this girl!

    • User profile image
      Jovan

      Great job!

    • User profile image
      KeplerIO

      I downloaded .net core binaries

      I opened VSCode, made new project directory, opened the terminal. I typed "dotnet new mvc" in order to create an ASP.NET5 web app. I was greeted with this terminal error:

      PS C:\dotnetcore\Projects\Drizzle> dotnet new mvc
      dotnet : The term 'dotnet' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
      included, verify that the path is correct and try again.

      Any help?

    • User profile image
      King Victor

      Where's the like button, DAMN!

    • User profile image
      Anil

      hi after installing .net core i continued your steps towards terminal and executed command "dotnet new"
      but shows error that "'dotnet' is not recognized as an internal or external command,
      operable program or batch file."

    Add Your 2 Cents