DEV Community

loading...

ASP.NET Core Tutorial for Beginners

DotNetCrunch
A blog & a guide for the latest Microsoft® & related technologies aimed for beginners/ intermediate level professionals.
・3 min read

alt text

In this ASP.NET Core tutorial for beginners, we will be discussing in detail about the ASP.NET Core framework, installation, and setup, creating and running a “hello world” application in asp.net core.

What is ASP.NET Core?

ASP.NET Core is a cross-platform, open-source framework for building modern cloud-based applications.

Its a redesign of the previous version of ASP.NET 4.x for that reason it was initially called ASP.NET 5 but later renamed to ASP.NET Core.

ASP.NET Core Benefits and Features

Below are the benefits and features offered by one of the most popular software development framework:

  • Cross-Platform: ASP.NET Core applications can be developed and run across multiple platforms – macOS, Windows, and Linux.
  • Hosting: They can be hosted on IIS, Apache, Docker, and also self-hosted.
  • IDE: You can use visual studio code, visual studio, sublime code editor.
  • Programming Model: It offers a unified programming model for MVC and Web API. Both MVC Controller and Web API Controller class inherit from the same Controller base class and returns IActionResult.
  • Dependency Injection: ASP.NET Core comes with built-in support for DI.
  • Testability: As this framework comes with built-in dependency injection and unified programming model, UNIT testing for the .net core applications is easy.
  • Community Support: As the ASP.net core framework is open source and it has great community support. It is continually evolving as the vast community behind it is suggesting ways to improve it and helping in fixing bugs and problems.

Prerequisite for learning ASP.NET Core

  • Basic knowledge of HTML, CSS, JavaScript & C#
  • MVC knowledge would be helpful but not required.

Tools Needed for ASP.NET Core Development

  • IDE: Visual Studio, VS Code, Sublime Text (Any one of these)
  • .NET Core SDK (Software Development Kit)

In this asp.net core tutorial, we are going to use the VS Code as an editor for our software development using ASP.NET Core applications.

Installing VSCode

For installing Visual Studio Code, please visit – https://code.visualstudio.com and download the respective version – macOS, Windows, Linux as per your development machine.

Installing .NET Core SDK

Download the SDK from Microsoft’s official website – https://dotnet.microsoft.com/download

At the time of writing this article, the latest stable version is .NET Core 3.1.

Create Your First ASP.NET Core Application

Now, the development machine is ready, let’s begin creating our first ASP.NET Core application and display “Hello World” on the web browser.

Open cmd by going to run (window + R) and enter the command given below. This command will create a new web app named aspnetcoreapp.

dotnet new webapp -o aspnetcoreapp
Enter fullscreen mode Exit fullscreen mode

Now for running your app, use the following commands:

cd aspnetcoreapp
dotnet watch run
Enter fullscreen mode Exit fullscreen mode

After the above command indicates that the app has started, open your web browser, and navigate to:

http://localhost:5001
Enter fullscreen mode Exit fullscreen mode

So now, you will be presented with a Welcome page. In order to display the “Hello World” message, Open Index.cshtml file under the Pages folder.

Modify the file as shown in the screenshot and then save the page.

Once, done with all these actions, refresh the page http://localhost:5001 and verify your changes as shown below.

Summary

So far in this asp.net core tutorial, you have learned:

  • ASP.NET Core is an open-source, cross-platform framework for building modern applications.
  • It offers a wide range of features, few of those are cross-platform support, unified programming model, large community support, etc.
  • You need basic knowledge of HTML, CSS, JavaScript, and C# to start learning asp.net core.
  • All you need is one of the IDE along with .NET Core SDK to get started.
  • Build your first program or hello world application using asp.net core framework.

We are concluding with the hope that you enjoyed going through this asp.net core tutorial.

👉 Please share it with your friends interested in learning asp.net core.

Happy Programming!

👇 Check these books on ASP.NET Core 👇

alt text

Discussion (1)

Collapse
sharpninja profile image
The Sharp Ninja

Good tutorial on setting up a new project. Please show users how to add and modify Views in your next article.