Getting Started With ASP.NET Core

In this article, we will learn how to create a console application and a web application using ASP.NET Core and how to publish the application on a local system. 

What is ASP.NET Core?

ASP.NET Core is a new and open source version of  ASP.NET Core, released by Microsoft. It is a cross-platform web framework to build applications which can be run on different platforms like Windows, Mac, and Linux.

Why ASP.NET Core?

  • It supports cross-platform.
  • It is faster and simplifies modern web app development.
  • It provides in-built support for IoC Container.
  • It allows us to integrate with modern UI framework.
  • Its hosting can be done on any server, like IIS, Apache, or self-hosting in our own process.
  • It supports Side-by-Side app versioning.

Getting started with ASP.NET Core

If you don't have the latest version of Visual Studio, then you can download VS 2017. There are three editions for VS 2017. You can download a free version, i.e., VS 2017 Community Edition from the above link.

Create First Console Application In ASP.NET Core

Step 1

Click on the File menu.

Step 2

Click New >> Project. 
 
How To Start With ASP.NET Core 

Step 3

Click on Visual C# >> .NET Core in the left pane.

Step 4

Click on Console App (.NET Core) in the right side pane.

Step 5

Give a name to your project and click OK.
 
How To Start With ASP.NET Core 

Yes, we are ready with our first console app in .NET Core.

How To Start With ASP.NET Core 
 
How To Start With ASP.NET Core 

Here is the output of our first console application in .NET Core.

How To Start With ASP.NET Core
 

How to create your first web application in .NET Core

Step 1

Add a new project from the File menu.

Step 2

Select "ASP.NET Core Core Web Application" in the right pane after choosing Visual C# > Web > .NET Core from the left side.
 
How To Start With ASP.NET Core 

Step 3

Click OK and select Web Application (Model-View-Controller) as in the below screen. 
 
How To Start With ASP.NET Core 

Step 4

Once you click OK, you are ready with your first MVC web application in .NET Core with the below default folder structure.
 
How To Start With ASP.NET Core 

Step 5

Now, we are ready with a default folder structure and ready to run the "hello world" application.

Step 6

Let us press F5 to run our first .NET Core web application.
 
How To Start With ASP.NET Core 

How to publish a .NET Core Application

Step 1

Select the "Release" option from top ribbon and right-click on the solution name in Solution Explorer. Click on the "Publish.." option, circled in the below screen.
 
How To Start With ASP.NET Core 

Step 2

It will give all the different options to publish the application on different platforms, like Linux, Azure, ISS, FTP, or Local system.
 
How To Start With ASP.NET Core 

Step 3

Here, we are selecting the Folder option to publish it on a local system.
 
How To Start With ASP.NET Core 

Finally, the published code looks like the below screen. We can use the same file for hosting the app on IIS too.

How To Start With ASP.NET Core
 

Conclusion

Here, we are finished with the creation and publishing of a simple console and web application using .NET Core in a local environment. 

I hope it will help.