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.

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

Create a Project

go to command line and type

dotnet new console -o "ConsoleApplicationdemo"

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!”

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!”);

then click the debugg button

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

then debugg it

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

You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to 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.

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