ASP.NET5 applications use. NET core to build applications by default,. NET core is a small, optimized. NET runtime application.
1. What is the. NET Core
. NET Core 5 is made up of a modular runtime and class library. Directory it has been implemented on Windows, and is being developed on Linx and OS X.. NET core consists of a series of class libraries, called "Corefx", and a small, optimized runtime called "CoreCLR". . NET core is fully open source, and you can also contribute your own code in.
The CoreCLR runtime and Corefx class libraries are available through NuGet, and Corefx can obtain the appropriate DLLs from NuGet based on specific functionality, such as "System." [Module] ".
One of the key benefits of. NET core is its portability. You can easily package and deploy your application without having to install. NET applications on your windows as before. You can use different versions of CORECLR to develop applications and upgrade applications on the same machine without forcing a new version to be used at the same time.
Corefx integrates a single component form, each DLL relies on a minimum set of DLLs, for example System.Collection only relies on system.runtime, and does not require System.Xml, Corefx contains collections, console acess , diagnostics, IO, LINQ, JSON, XML, and regular expression support, another advantage is that corefx the same DLL can support different platforms.
2. The motivation behind. NET Core
When. NET first appeared in 2002, it was a single framework that soon launched the. NET Compact Framework, which is a small application on mobile devices. Over the years, some common features have been repeated in two different versions, so that they later compete for different. NET versions of different platforms. There are other versions of. NET, such as mono and Xmarin, on Linux, Mac, and Android. For each platform, they each develop runtime, framework and application models. One of the first goals of. NET core is to provide a single, modular, cross-platform. NET version that works on different platforms.. NET core is fully open source, People in the mono community can take advantage of Corefx's class library.. NET core does not replace mono, but it allows the mono community to reference and share it and directly contribute code to COREFX.
In addition to being able to apply to different device platforms, the pressure of service from one aspect is to reduce the overall architecture, the most important is to break down the Corefx into a functional module so that the application can pull the corresponding DLL as needed, reducing the dependency between the two. This, in turn, reduces the frequency of upgrades and patching to reduce the impact on applications, and the deployment of a small application is independent, and different versions of the application can be deployed on the same server.
3. Create an application with. NET Core
. NET core can create different applications, including Web applications, console applications, and localized mobile applications. DNX provides a cross-platform runtime host that you can use to create a. NET core-based application that can be executed on Windows, Macs, and Linx, and it is the basis for an ASP. Applications running on DNX can use the. NET Framework or the. NET Core framework, and the DNX project can be configured with both architectures in one project. So it has two configurations in Project.json, as follows:
"Frameworks": {
"dnx451": {},
"Dnxcore50": {}
},
dnx451 represents the old. NET Framework, DNXCORE50 represents. NET Core 5 (5.0). You can use the precompiled command # if to test which frame is associated: DNX451 and DNXCORE50. For example:
#if DNX451
Utilize resource only available with. NET Framework
#endif
Asp. NET team recommendation is two frameworks are configured, if you only want to use one, you can also delete another. Note asp.net4.6 and earlier versions must use the. NET Framework.
4.. NET Core and NuGet
With NuGet, you can quickly get every class library that makes up. NET Core. This means that the application can list a collection of nuget packages containing systems, architectures, and third-party frameworks. In addition, a third-party framework can display its dependencies, which makes it easy to get the appropriate version of the package when it is developed or created.
Although Corefx is made up of a single NuGet package, Microsoft also regularly launches a full package, of course with a low frequency.
Introduction to. NET Core