Pages

Friday, July 27, 2018

Create dotnet core console application using Visual Studio code from the command prompt

Prerequisites:

.NET core and Visual Studio Code setup is completed.

To cross check if  .NET core is installed and path is configured type

>dotnet --version 

in the command prompt







Returning the version indicates that the dotnet core was successfully installed.

.NET CLI --It is the tool which is used for creating the console application i.e scaffolding ,debugging and building the console application.

Create HelloApp

There are multiple ways to create the console application.

In the command prompt , run the following command

>dotnet new console -o HelloApp




The dotnet command creates a new application of type console.The -o parameter creates a dircetory named HelloApp where your app is stored and populates it with the required files.

The HelloApp has Program.cs file when run prints Hello world on console.

Nvaigate to HelloApp from command prompt using the following command 

> cd HelloApp








Run the Application

Run the application using the command 

>dotnet run

 to see the output Hello world!







Open the App in Visual studio code editor
-----------------------------------------------------
To open the project in the visual studio code editor from the command prompt type the following command

>code .






Congratulations on your first .NET core console application :) .Happy Coding!

Thursday, July 26, 2018

Comment mutiple lines of code in the visual studio code


Following is the way to comment multiple lines of code in the visual studio  code

Shift+alt+a

All the VS code shortcuts can be found at VS keyboard shortcuts

Duplicate a line or selection within Visual Studio Code in windows


Following is the way to open duplicate a line or selection in the visual studio  code

Shift+alt+down and shift+alt+up

The associated keybindings can be seen by navigating to : File > Preferences > Keyboard Shortcuts from the menu 

Format or beautify code in Visual Studio Code


Following is the way to format the or beautify the code in the visual studio  code

 1)Use the shift+alt+f keyboard shortcut on Windows .
 2)Use the shift+option+f  keyboard shortcut on Mac.

How to open terminal in Visual studio Code


Following is the way to open the terminal in the visual studio  code

 1)Use the Ctrl+` keyboard shortcut.
 2)Navigate to View -> Integrated Terminal menu command.
 3)From the Command Palette (Ctrl+Shift+P), use the View:Toggle Integrated Terminal command.

How to stop or terminate node server

To terminate or to stop node server from the command prompt press CTRL+c

Press y to terminate or to stop the server