41 Followers
·
Follow

Create a Console Application Using .net core and visual studio code

Visual studio code is past than visual studio and light weight and all function are available.

if we compare with visual studio we can not get all features free.Community version only free. it is only best for student and teacher.

Image for post
Image for post
source:https://www.visualstudio.com/vs/compare/

Need to install

  1. Install Visual Studio Code.

2.Install the .NET Core SDK.

3. Install the C# extension for Visual Studio Code.

when you finish the install check by command line=>

dotnet --version
Image for post
Image for post

Create a Project

go to command line and type

dotnet new console -o "ConsoleApplicationdemo"
Image for post
Image for post

now you create all files that ,you want to build a console application.

by dotnet new console command we got template of the project.

and “consoleapplicationdemo” is the name of template.

then in the command line type dotnet run .now you can get the output window “Hello World!”

Image for post
Image for post

by enter this code open your project in VScode

E:\visualstudiocodedemo\ConsoleApplicationdemo>code .

When you start your project you will get a missing assets to build and debug app.Select yes.

source:https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio-code

you can try this on your terminal windows also.just type dotnet run .you can get the out put .

debugging

go to your program.cs file then put a break point in the line of

Console.WriteLine(“Helo World!”);
Image for post
Image for post

then click the debugg button

Image for post
Image for post

And select the .NET Core Launch(console) because we are creating console application.

Image for post
Image for post

then debugg it

Image for post
Image for post

you will be stop in the break point (can not get out put)

You may only use the Microsoft .NET Core Debugger (vsdbg) withVisual Studio Code, Visual Studio or Visual Studio for Mac softwareto help you develop and test your applications. — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -Loaded ‘C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.5\System.Private.CoreLib.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled.Loaded ‘E:\visualstudiocodedemo\ConsoleApplicationdemo\bin\Debug\netcoreapp2.0\ConsoleApplicationdemo.dll’. Symbols loaded.Loaded ‘C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.5\System.Runtime.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled.Loaded ‘C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.5\System.Console.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled.

we can move step by step by press f10 key.we you press f10 key your code will load and you will get the output.

Image for post
Image for post

Hope this short article helped to build and debug the Console application in Visual Studio Code.

source code:https://github.com/kajasumanie/ConsoleApplicationdemo

Ref:https://www.youtube.com/watch?v=t4heVCEe3u8&t=649s

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store