Skip to content

Add Debug section to VS Code Getting Started #1314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 24 additions & 2 deletions docs/csharp/getting-started/with-visual-studio-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ms.assetid: 76c23597-4cf9-467e-8a47-0c3703ce37e7

---

# Getting started with Visual Studio Code
# Getting Started with Visual Studio Code

.NET Core gives you a fast and modular platform for creating server applications that run on Windows, Linux and macOS. 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.

Expand All @@ -31,7 +31,7 @@ If you'd like to get started with a simple "Hello World" program on .NET Core, f

* Open VS Code.
* Go to the File Explorer Tab on the left.
* Open the folder you want you C# project to be in.
* Open the folder you want your C# project to be in.

![VSCodeOpenFolder](media/with-visual-studio-code/VSCodeOpenFolder.PNG)

Expand All @@ -48,6 +48,8 @@ If you'd like to get started with a simple "Hello World" program on .NET Core, f
* 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.

> Tip: If you are using the MSBuild-based .NET Core Tools a .csproj will be created instead of a project.json, but the `dotnet` commands remain the same. [Read more](https://blogs.msdn.microsoft.com/dotnet/2016/11/16/announcing-net-core-tools-msbuild-alpha/).

![Image dotnet restore](media/with-visual-studio-code/dotnetRestore.PNG)

4. Run the "Hello World" program by typing `dotnet run`
Expand All @@ -56,3 +58,23 @@ If you'd like to get started with a simple "Hello World" program on .NET Core, f

You can also watch a short video tutorial for further setup help on [Windows](https://channel9.msdn.com/Blogs/dotnet/Get-started-with-VS-Code-using-CSharp-and-NET-Core), [macOS](https://channel9.msdn.com/Blogs/dotnet/Get-started-with-VS-Code-using-CSharp-and-NET-Core-on-MacOS), or [Linux](https://channel9.msdn.com/Blogs/dotnet/Get-started-with-VS-Code-Csharp-dotnet-Core-Ubuntu).

## Debug
1. Open Program.cs by clicking on it. The first time you open a C# file in VS Code omnisharp will load in the editor.

![OpenCS](media/with-visual-studio-code/OpenCS.PNG)
2. Open the Debug tab on the left side. The icon is a bug with a cancel line through it.
* You can also open the Debug tab by selecting View > Debug

![OpenDebug](media/with-visual-studio-code/OpenDebug.PNG)
2. Locate the green arrow at the top of the pane. Make sure the drop down next to it has `.NET Core Launch (console)` selected.

![SelectCore](media/with-visual-studio-code/SelectCore.PNG)
3. Add a breakpoint to your project by clicking in the space left of the line numbers in the editor.

![SetBreakpoint](media/with-visual-studio-code/SetBreakpoint.PNG)
4. Hit F5 or the green arrow to start debugging. The debugger stops execution of your program when it reaches the breakpoint you set in (3) above.
* While debugging you can view your local variables in the top left pane or use the debug console.

![RunDebug](media/with-visual-studio-code/RunDebug.PNG)
6. Hit the green arrow at the top to continue debugging or press the red square to stop.