diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/OpenDebug.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/OpenDebug.PNG deleted file mode 100644 index a9229cd56e5f7..0000000000000 Binary files a/docs/csharp/getting-started/media/with-visual-studio-code/OpenDebug.PNG and /dev/null differ diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/VSCodeOpenFolder.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/VSCodeOpenFolder.PNG deleted file mode 100644 index 46e13e8151241..0000000000000 Binary files a/docs/csharp/getting-started/media/with-visual-studio-code/VSCodeOpenFolder.PNG and /dev/null differ diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/Continue.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/continue.png similarity index 100% rename from docs/csharp/getting-started/media/with-visual-studio-code/Continue.PNG rename to docs/csharp/getting-started/media/with-visual-studio-code/continue.png diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/dotnetNew.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/dotnetnew.png similarity index 100% rename from docs/csharp/getting-started/media/with-visual-studio-code/dotnetNew.PNG rename to docs/csharp/getting-started/media/with-visual-studio-code/dotnetnew.png diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/dotnetRestore.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/dotnetrestore.png similarity index 100% rename from docs/csharp/getting-started/media/with-visual-studio-code/dotnetRestore.PNG rename to docs/csharp/getting-started/media/with-visual-studio-code/dotnetrestore.png diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/dotnetRun.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/dotnetrun.png similarity index 100% rename from docs/csharp/getting-started/media/with-visual-studio-code/dotnetRun.PNG rename to docs/csharp/getting-started/media/with-visual-studio-code/dotnetrun.png diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/missing-assets.png b/docs/csharp/getting-started/media/with-visual-studio-code/missing-assets.png new file mode 100644 index 0000000000000..fbf698c4bf0f8 Binary files /dev/null and b/docs/csharp/getting-started/media/with-visual-studio-code/missing-assets.png differ diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/OpenCS.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/opencs.png similarity index 100% rename from docs/csharp/getting-started/media/with-visual-studio-code/OpenCS.PNG rename to docs/csharp/getting-started/media/with-visual-studio-code/opencs.png diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/opendebug.png b/docs/csharp/getting-started/media/with-visual-studio-code/opendebug.png new file mode 100644 index 0000000000000..d305fe0574d79 Binary files /dev/null and b/docs/csharp/getting-started/media/with-visual-studio-code/opendebug.png differ diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/RunDebug.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/rundebug.png similarity index 100% rename from docs/csharp/getting-started/media/with-visual-studio-code/RunDebug.PNG rename to docs/csharp/getting-started/media/with-visual-studio-code/rundebug.png diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/SelectCore.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/selectcore.png similarity index 100% rename from docs/csharp/getting-started/media/with-visual-studio-code/SelectCore.PNG rename to docs/csharp/getting-started/media/with-visual-studio-code/selectcore.png diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/SetBreakpoint.PNG b/docs/csharp/getting-started/media/with-visual-studio-code/setbreakpoint.png similarity index 100% rename from docs/csharp/getting-started/media/with-visual-studio-code/SetBreakpoint.PNG rename to docs/csharp/getting-started/media/with-visual-studio-code/setbreakpoint.png diff --git a/docs/csharp/getting-started/media/with-visual-studio-code/vscodeopenfolder.png b/docs/csharp/getting-started/media/with-visual-studio-code/vscodeopenfolder.png new file mode 100644 index 0000000000000..4a98816ddfe32 Binary files /dev/null and b/docs/csharp/getting-started/media/with-visual-studio-code/vscodeopenfolder.png differ diff --git a/docs/csharp/getting-started/with-visual-studio-code.md b/docs/csharp/getting-started/with-visual-studio-code.md index e68f6bd65f634..ca76f030ebc41 100644 --- a/docs/csharp/getting-started/with-visual-studio-code.md +++ b/docs/csharp/getting-started/with-visual-studio-code.md @@ -1,10 +1,10 @@ --- -title: Getting started with visual Studio Code | C# Guide -description: Getting Started with Visual Studio Code +title: Getting started with Visual Studio Code | C# Guide +description: Learn how to create and debug your first .NET Core application in C# using VS Code. keywords: C#, Getting Started, Acquisition, Install, Visual Studio Code, Cross Platform author: kendrahavens ms.author: wiwagn -ms.date: 11/14/2016 +ms.date: 12/09/2016 ms.topic: article ms.prod: .net ms.technology: devlang-csharp @@ -16,64 +16,79 @@ ms.assetid: 76c23597-4cf9-467e-8a47-0c3703ce37e7 .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. -## Getting Started +## Prerequisites 1. Install [Visual Studio Code](https://code.visualstudio.com/). -2. Install [.NET Core](https://microsoft.com/net/core). +2. Install the [.NET Core SDK](https://www.microsoft.com/net/download/core). 3. Install the [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp) 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: +Let's get started with a simple "Hello World" program on .NET Core: 1. Open a project: * Open VS Code. - * Go to the File Explorer Tab on the left. - * Open the folder you want your C# project to be in. + * Click on the Explorer icon on the left menu and then click **Open Folder**. + * Select the folder you want your C# project to be in and click **Select Folder**. - ![VSCodeOpenFolder](media/with-visual-studio-code/VSCodeOpenFolder.PNG) + ![VSCodeOpenFolder](media/with-visual-studio-code/vscodeopenfolder.png) + + * Alternatively, you can select **File** > **Open Folder** from the main menu to open your project folder. 2. Initialize a C# project: - * Open the command prompt (or terminal). You can open the terminal from VS Code by typing CTRL+` (Back Tick) - * Type `dotnet new` + * Open the Integrated Terminal from VS Code by typing CTRL+` (backtick). + * In the terminal window, type `dotnet new`. * This creates a `Program.cs` file in your folder with a simple "Hello World" program already written. - ![dotnetNew](media/with-visual-studio-code/dotnetNew.PNG) + ![dotnet new command](media/with-visual-studio-code/dotnetnew.png) -3. Resolve the build assets by typing `dotnet restore` +3. Resolve the build assets: - * Running `restore` pulls down the required packages declared in the `project.json` file. + * Type `dotnet restore`. Running `dotnet 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. -> 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/). + > TIP: If you are using the MSBuild-based .NET Core Tools a .csproj file will be created instead of a project.json one, but the `dotnet` commands you need to execute remain the same. For more information, see the [MSBuild-based tooling announcement](https://blogs.msdn.microsoft.com/dotnet/2016/11/16/announcing-net-core-tools-msbuild-alpha/) on the .NET blog. + + ![dotnet restore command](media/with-visual-studio-code/dotnetrestore.png) - ![Image dotnet restore](media/with-visual-studio-code/dotnetRestore.PNG) +4. Run the "Hello World" program: -4. Run the "Hello World" program by typing `dotnet run` + * Type `dotnet run`. - ![dotnetRun](media/with-visual-studio-code/dotnetRun.PNG) + ![dotnet run command](media/with-visual-studio-code/dotnetrun.png) 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. +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. + + ![Open Program.cs file](media/with-visual-studio-code/opencs.png) + +2. VS Code will prompt you to add the missing assets to build and debug your app. Click **Yes**. + + ![Prompt for missing assets](media/with-visual-studio-code/missing-assets.png) - ![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 +3. To open the Debug view, click on the Debugging icon on the left side menu. - ![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. + ![Open the Debug tab](media/with-visual-studio-code/opendebug.png) - ![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. +4. Locate the green arrow at the top of the pane. Make sure the drop-down next to it has `.NET Core Launch (console)` selected. - ![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. + ![Select .NET Core](media/with-visual-studio-code/selectcore.png) + +5. Add a breakpoint to your project by clicking on the **editor margin** (the space on the left of the line numbers in the editor). + + ![Set a Breakpoint](media/with-visual-studio-code/setbreakpoint.png) + +6. Hit F5 or the green arrow to start debugging. The debugger stops execution of your program when it reaches the breakpoint you set the previous step. * 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. + ![Run and Debug](media/with-visual-studio-code/rundebug.png) + +7. Hit the green arrow at the top to continue debugging or press the red square to stop. +## See also +- [Setting up Visual Studio Code](https://code.visualstudio.com/docs/setup/setup-overview) +- [Debugging in Visual Studio Code](https://code.visualstudio.com/Docs/editor/debugging)