asp-dotnet-core

This post will show you how to get started with your first program in dot net with visual studio. Let’s focus on setting up .Net core on visual studio and building a simple “Hello World” application with .Net

First, we need to understand what is Net(dotnet) ?
.Net started in 2002 that runs on Visual Studio. It is an open source framework and was released by Microsoft and maintained by .Net community. It runs on Microsoft platforms and can be developed on cross-platform application which can be built on Windows, Linux and Mac OS.

We will learn to code on three different platforms of OS. Taking windows OS as an example:-
Install Visual Studio Community 2017. Select the Community download (Skip this step if you have Visual Studio 2017 installed).
→ For windows – Download here
→ For Mac OS – Download here
→ For Linux – Download here

Then Run the installer and select the following workloads you will find below:-
→ ASP.NET and web development (under Web & Cloud)
→ .NET Core cross-platform development (under Other Toolsets)

visualstudio

visualstudio2

Now create a web app,
In visual studio Go to File → New → Project Find it below how?
Microsoftvisual studioAfter completing the new project dialog:-
→ Click on .Net core in the left pane.
→ Click on .Net core  web apps in the center pane.
→ Name your project as it is mandatory. Name it as “McMovie” so that it matches with your namespace.
→ Then click OK

Microsoft visual studio

Complete the New ASP.NET Core Web Application (.NET Core) – MvcMovie dialog
→ In the version selector drop-down box — Click on ASP.NET Core 1.
→ Go to and click on Web Application
→ Keep the default “No Authentication”
→ Then click OK.

For MVC project, visual studio used a default template which you just created. Now you can see that you have a working app right now by entering the project name and choose few options in that. Press F5 to run the app in debug mode and control F5 in non-debug mode.

Visual studio runs your app while it starts IIS Express. Address bar shows localhost:port# with no web address. Localhost is the standard hostname for your computer. When a web project is created a random port is used for your web server it is 5000 and when you run the app you will find a different port number.

Starting with Hello World application
→ Enhancing Hello World Application
Now, add the code given below in Main function to make the changes.
Console.WriteLine(“\nWhat is your name? “);
var name = Console.ReadLine();
var date = DateTime.Now;
Console.WriteLine(“\nHello, {0}, on {1:d} at {1:t}”, name, date);
Console.Write(“\nPress any key to exit…”);
Console.ReadKey(true);

Once changes are complete, click save button, deploy an Application and the output is given below.
dotnetexe

Here you are done with your first hello world app which you have successfully deployed an Application in Visual Studio 2017 using .NET Core. You can also refer to microsoft.com for more such tutorials and guides.