Breaking

Search Here

30 December 2019

ASP.NET Core Tutorials




ASP.NET Core Tutorials

ASP.NET Core is a new version of ASP.NET by Microsoft. It is an open-source web framework which can be run on Windows, Mac, or Linux.

These tutorials will help you understand ASP.NET Core web application step by step. Tutorials are broken down into chapters, where each chapter contains a number of related topics that are packed with easy to understand explanations and real-world examples.

These tutorials are designed for beginners and professionals who want learn how to build ASP.NET Core web applications step by step.

Prerequisites

Basic knowledge of C#, HTML, Visual Studio, and Object Oriented Programming is required.

So let's get started by clicking Next.

ASP.NET Core Test
Test your ASP.NET Core 2.0 knowledge with a quick test. It includes 20 questions and each question includes 4 options. Select an appropriate answer out of 4 options. There is no time limit for this test.

ASP.NET Core Tutorials

ASP.NET Core is a new version of ASP.NET by Microsoft. It is an open-source web framework which can be run on Windows, Mac, or Linux.
These tutorials will help you understand ASP.NET Core web application step by step. Tutorials are broken down into chapters, where each chapter contains a number of related topics that are packed with easy to understand explanations and real-world examples. 

This is very important and helpful

.NET Core Overview

.NET Core is a new version of .NET Framework, which is a free, open-source, general-purpose development platform maintained by Microsoft. It is a cross-platform framework that runs on Windows, macOS, and Linux operating systems.
.NET Core Framework can be used to build different types of applications such as mobile, desktop, web, cloud, IoT, machine learning, microservices, game, etc.
.NET Core is written from scratch to make it modular, lightweight, fast, and cross-platform Framework. It includes the core features that are required to run a basic .NET Core app. Other features are provided as NuGet packages, which you can add it in your application as needed. In this way, the .NET Core application speed up the performance, reduce the memory footprint and becomes easy to maintain.


Why .NET Core?

There are some limitations with the .NET Framework. For example, it only runs on the Windows platform. Also, you need to use different .NET APIs for different Windows devices such as Windows Desktop, Windows Store, Windows Phone, and Web applications. In addition to this, the .NET Framework is a machine-wide framework. Any changes made to it affect all applications taking a dependency on it. Learn more about the motivation behind .NET Core here.
Today, it's common to have an application that runs across devices; a backend on the web server, admin front-end on windows desktop, web, and mobile apps for consumers. So, there is a need for a single framework that works everywhere. So, considering this, Microsoft created .NET Core. The main objective of .NET Core is to make .NET Framework open-source, cross-platform compatible that can be used in a wide variety of verticals, from the data center to touch-based devices.

.NET Core Characteristics

Open-source Framework: .NET Core is an open-source framework maintained by Microsoft and available on GitHub under MIT and Apache 2 licenses. It is a .NET Foundation project.
You can view, download, or contribute to the source code using the following GitHub repositories:
Language compiler platform Roslyn: https://github.com/dotnet/roslyn
.NET Core runtime: https://github.com/dotnet/runtime
.NET Core SDK repository. https://github.com/dotnet/sdk
ASP.NET Core repository. https://github.com/dotnet/aspnetcore
Cross-platform: .NET Core runs on Windows, macOS, and Linux operating systems. There are different runtime for each operating system that executes the code and generates the same output.
Consistent across Architectures: Execute the code with the same behavior in different instruction set architectures, including x64, x86, and ARM.
Wide-range of Applications: Various types of applications can be developed and run on .NET Core platform such as mobile, desktop, web, cloud, IoT, machine learning, microservices, game, etc.
Supports Multiple Languages: You can use C#, F#, and Visual Basic programming languages to develop .NET Core applications. You can use your favorite IDE, including Visual Studio 2017/2019, Visual Studio Code, Sublime Text, Vim, etc.
Modular Architecture: .NET Core supports modular architecture approach using NuGet packages. There are different NuGet packages for various features that can be added to the .NET Core project as needed. Even the .NET Core library is provided as a NuGet package. The NuGet package for the default .NET Core application model is Microsoft.NETCore.App.
This way, it reduces the memory footprint, speeds up the performance, and easy to maintain.
CLI Tools: .NET Core includes CLI tools (Command-line interface) for development and continuous-integration.
Flexible Deployment: .NET Core application can be deployed user-wide or system-wide or with Docker Containers.
Compatibility: Compatible with .NET Framework and Mono APIs by using .NET Standard specification.

.NET Core Version History

Version Latest Version Visual Studio Release Date End of Support
.NET 5 Preview 1 VS 2019 16th March, 2020
.NET Core 3.x - latest 3.1.3 VS 209 24th March, 2020 12th March, 2022
.NET Core 2.x 2.1.17 VS 2017, 2019 24th March, 2020 21st August, 2021
.NET Core 1.x 1.1.13 VS 2017 14th May, 2019 27th May, 2019
Both, .NET 3.1, and .NET Core 2.1 will have long term support.
.NET Core 3.x applications only run on .NET Core Framework.
.NET Core 2.x applications run on .NET Core as well as .NET Framework.
.NET Core Composition
The .NET Core Framework composed of the following parts:

.NET Core

CLI Tools: A set of tooling for development and deployment.
Roslyn: Language compiler for C# and Visual Basic
CoreFX: Set of framework libraries.
CoreCLR: A JIT based CLR (Command Language Runtime).

Install .NET Core, ASP.NET Core

Here you will learn to prepare a development environment for building .NET Core/ASP.NET Core applications.
.NET Core can be installed in two ways: By installing Visual Studio 2017/2019 or by installing .NET Core Runtime or SDK.
.NET Core installer already contains ASP.NET Core libraries, so there is no separate installer for ASP.NET Core.

Install Visual Studio

Currently, .NET Core 2.1 and .NET Core 3.1 is having long term support. Visual Studio 2017 supports .NET Core 2.1, whereas Visual Studio 2019 supports both the versions.
You can use your favorite IDE, such as Visual Studio, Visual Studio Code, Sublime Text, etc. to develop, restore, build, and run .NET Core application. Here, we will use Visual Studio 2019.
If you don�t have Visual Studio on your development PC, then it is recommended to install the latest Visual Studio 2019. If you already have either Visual Studio 2017 or 2019, then you already have installed .NET Core 2.1.
Download and install Visual Studio 2019 based on your OS from here. Select the appropriate edition as per your license. The community edition is free for students, open-source contributors, and individuals.
During installation, select ".NET Core cross-platform development" workload. This will install .NET Core 2.1. However, you need to install .NET Core 3.1 SDK separately.
Once installed, you can verify it by opening a command prompt (or terminal in Mac) and type dotnet --version and press Enter. This will display the installed version and usage information, as shown below.
C:\Users\dev>dotnet --version
2.1.805

ADVERTISEMENT

Install .NET Core 3.x
As you have seen, Visual Studio 2019 installer includes .NET Core 2.1 but not .NET Core 3.x. You need to install it separately.
To download the latest version of .NET Core, go to https://dotnet.microsoft.com/download and select the platform you are using.

Install .NET Core SDK for Windows

As you can see above, .NET Core Runtime and .NET Core SDK are different things. .NET Core Runtime is only used to run .NET Core application, whereas .NET Core SDK includes tools and libraries to develop .NET Core applications. To set up a development environment, we need to install .NET Core SDK for the platform we use for development such as Windows, Linux, or Mac. Here we will install .NET Core SDK because we are preparing a development environment for building .NET Core applications. If you are aiming to run .NET Core application, then install .NET Core Runtime on your server or cloud or client desktop.
Click on the Download .NET Core SDK button to download the latest version of .NET Core SDK installer. It will download .NET Core 3.1 SDK as of this writing.
After downloading the installer, click on it to start the installation.
Click on Install button and follow the wizard to install .NET Core 3.1 SDK.
After installation, you can now develop .NET Core/ASP.NET Core applications. Let's learn about it next.
Here, we will learn how to create our first ASP.NET Core 3.0 application in Visual Studio 2019.
Open Visual Studio 2019 and click on Create a new project, as shown below.
The "Create a new project" dialog box includes different .NET Core 3.0 application templates. Each will create predefined project files and folders depends on the application type. Here we will create a simple web application, so select ASP.NET Core Web Application template and click Next, as shown below.
Next, give the appropriate name, location, and the solution name for the ASP.NET Core application. In this example, we will give the name "MyFirstCoreWebApp" and click on the Create button, as shown below
Next, select appropriate ASP.NET Core Web application template such as Empty, API, Web Application, MVC, etc. Here, we want to create a web application, so select the Web Application template. We don't want HTTPS at this point, so uncheck Configure for HTTPS checkbox, as shown below. Also, make sure you have selected the appropriate .NET Core and ASP.NET Core versions. Click on the Create button to create a project.
This will create a new ASP.NET Core web project in Visual Studio 2019, as shown below. Wait for some time till Visual Studio restores the packages in the project. Restoring process means Visual Studio will automatically add, update or delete configured dependencies as NuGet packages in the project.
We will understand the project structure in the next chapter. To run this web application, click on IIS Express or press Ctrl + F5. This will open the browser and display the following result.
The above output comes from the Index.cshtml page under the Pages folder.
You can also see the IIS express icon on the system tray. Right click on it. You can see the ASP.NET sites currently running in your development machine.
Thus, we can create a new cross-platform ASP.NET Core 3.0 application that runs on .NET Core.
Learn about the project structure next.

2 comments:

Comments