In this ASP.NET Core tutorial for beginners, we will be discussing in detail the ASP.NET Core framework, installation, and setup, creating and running a “hello world” application in asp.net core.
Topics Covered
What is ASP.NET Core?
ASP.NET Core is a cross-platform, open-source framework for building modern cloud-based applications.
It’s 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 frameworks:
- 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 return IActionResult.
- Dependency Injection: ASP.NET Core comes with built-in support for DI.
- Testability: As this framework comes with built-in dependency injection and a unified programming model, UNIT testing for the .net core applications is easy.
- Community Support: As the ASP.net core framework is open source and 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.
Pre-requisites 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
Now for running your app, use the following commands:
cd aspnetcoreapp
dotnet watch run
After the above command indicates that the app has started, open your web browser, and navigate to:
http://localhost:5001
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, a 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 the 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!
Pingback: Collections in Python 3 : Easy To Understand - DotNetCrunch
Pingback: Best Resources to Learn ASP.NET Core - DotNetCrunch