Tutorial: ASP.NET Core First Console Application
Steps 1 ASP.NET Core — Environment Setup
To use ASP.NET Core in your application, the following must be installed in your system:
- Microsoft Visual Studio 2019 Community (Download VS2019)

- .NET Core 3.1 SDK (Download .Net Core3.1)

Step 2 New Project
Once you have installed the Visual Studio 2019, you can start building a new ASP.NET Core Console Application.
- Open VS2019

- On the start page, choose Create a new project.

- On the Create a New Project dialog box, you will see the following different templates for Web projects. Now select the Console App (.NET Core) template with C#:

- In the Configure your new project dialog, enter HelloWorldConsoleApp in the Project name box and select you location where it will save. Then choose Create.

- Now, you can see your new project is created and opened.

Step 3 Run Project
- Let us run this application, you can do that by pressing Ctrl+F5 or Click on Play button on top.

Reference Code:
static void Main(string[] args)
{
Console.WriteLine(“Hello World!”);
}
- A console window opens with the text “Hello World!” printed on the screen and some Visual Studio debug information.

- Press any key to close the console window.
Step 4 Enhance the application
Enhance the application to prompt the name which you entered and display it along with the date and time.
- Console.WriteLine is use for output and Console.ReadLine is use for input. So let’s use both combination and Enhance our app.
- In Program.cs replace the contents of the Main method, which is the line that calls Console.WriteLine, with the following code:

Reference Code:
static void Main(string[] args)
{
Console.WriteLine(“Hello!”);
Console.WriteLine(“\nWho are you there?”);
Console.WriteLine(“\nwaiting…for your good name.”);
var name = Console.ReadLine();
var date = DateTime.Now;
Console.WriteLine($”\nHello, {name}, on {date:d} at {date:t}!”);
Console.Write(“\nPress any key to exit…”);
Console.ReadKey(true);
}
- Now, Again Run Application by pressing Ctrl+F5 or Click on Play button on top.


- Respond to the prompt by entering a name and pressing the Enter key.
- Press any key to close the console window.
Thank you ….!