An Introduction to .NET Core


Since the initial version of .NET Framework (the first beta version of .NET 1.0 was released in the fall of 2000), Microsoft has released many more upgrades over the years. They did so with the intent to make the framework cross-platform, open-source, and modular. As such, the software giant has now come up with .NET Core Framework.
Designed for adaptability, Microsoft's .NET Core is an open-source, cross-platform, modular platform that enables you to build and deploy applications that are targeted at multiple operating systems. It should be noted that .NET Core is now available on the Windows, OS X, and Linux platforms. It is supported in several flavors of Linux, including Red Hat Enterprise Linux and Ubuntu. This article presents a discussion on .NET Core, its features, and why it is useful.

What Is .NET Core?

.NET Core is a new cross-platform .NET stack from Microsoft that is optimized for open-source development and agile delivery on NuGet. .NET Core is designed by Microsoft to support many different platforms and architectures. It should be noted that WPF and WinForms aren't supported on .NET Core. The MSDN states ".NET Core is a cross-platform, open-source, and modular .NET platform for creating modern web apps, microservices, libraries, and console applications."

Main Characteristics of .NET Core

The major characteristics of .NET Core include the following:
  • Cross-platform support
    It can work on multiple platforms, such as Windows, Mac, and Linux.

  • Flexible deployment
    You can deploy a .NET Core application side by side with your application seamlessly. It is a general-purpose development platform that consists of several components. These include the managed compilers, the runtime, and the base class libraries. It also includes many application models, such as the ASP.NET Core.

  • Modular
    .NET Core is composed of a set of modular components. This enables you to take advantage of the package you want to use rather than including the entire .NET Core framework. This boosts performance as you end up creating applications that contain just what you need.

  • Open-source
    .NET Core is open source using MIT and Apache 2 licenses and is available in GitHub.

.NET Core Stack: The Architectural Components

As we have already discussed, .NET Core is designed in a modular manner. Hence, it is componentized. The components of .NET Core include:
  • A .NET runtime
    This is used to provide type safety, garbage collection mechanism, native interop services, loading of assemblies, etc.

  • A collection of Framework Libraries
    These provide the primitive data types, the utilities, etc.

  • A collection of SDK tools and compilers
    These provide developer experience when working with the .NET Core SDK.

Getting Started with .NET Core

.NET Core is distributed in two ways: via NuGet as a package and also as a standalone distribution. You can download a copy of .NET Core here.
You can use Visual Studio 2019 Community Edition (it's free), and then install the .NET Core Tools for Visual Studio. Alternatively, you can use Visual Studio Code (if you don't want to use Visual Studio) and then install the C# extension and the .NET Core SDK.
.NET Core provides support for languages like C#, VB.NET, and F#, and all the latest language concepts—like generics, LINQ, and asynchronous programming—are supported. It should be noted that .NET Core refers to several technologies. These include .NET Core, ASP.NET Core, and Entity Framework Core. All of these technologies run on top of the CoreCLR runtime environment.
Essentially, there are two main distributions of .NET Core: .NET Core and .NET SDK. While the former includes the .NET Core runtime, the latter consists of the .NET Core Tools.

Comparing and Contrasting .NET Framework and .NET Core

Now let's take a quick tour of how .NET Framework and .NET Core compare and contrast to each other. Well, both are managed frameworks, and they have their own runtime environments and garbage collection mechanisms. Here’s the list of the differences between these two frameworks.
  • Open-source
    While only a subset of .NET Framework is open source, the entire .NET Core framework is open source.

  • Subsystems
    .NET Core has adopted a simpler programming model. Some of the features of .NET Framework—like Code Access Security—are not supported by .NET Core.

  • Multi-platform support
    Unlike .NET Framework, .NET Core provides support for multiple platforms, i.e., Windows, Mac OS, and also Linux.

  • Fewer Application Programming Interfaces (APIs) support
    As of this writing, .NET Core doesn’t support all the APIs that are available in .NET Framework.
You can take a look here at the .NET Core roadmap to get to know more about the recent developments in this framework.

Introducing ASP.NET Core

ASP.NET Core is the latest Web application development framework from Microsoft. It is a significant redesign of the legacy ASP.NET framework and has already become widely popular. ASP.NET Core is a lean, composable, Open Source framework that you can use to build Web and Cloud applications. Most importantly, ASP.NET Core is available on Windows, Linux, and Mac platforms. Cross-platform support, unified programming model, and in-built support for dependency injection are some of the striking new features introduced as part of the ASP.NET Core framework.
Here's the list of the important features of ASP.NET Core.
Open Source
ASP.NET Core is an open-source Web application development framework. You can get the source code and the documentation from GitHub.

ASP.NET Core is a modular framework. ASP.NET Core (formerly known as ASP.NET 5) is composed of modular components and it is optimized with minimal overhead. In essence, ASP.NET Core provides you a much leaner framework and you can take advantage of this modularity by installing just those packages that you need via NuGet.

Unified framework
ASP.NET Core is now no longer based on System.Web.dll assembly. Rather, it is now based on a collection of granular, modular packages that can be installed via NuGet. It should also be noted that ASP.NET Core provides a unified programming model. Hence, you now have a single base class named Microsoft.AspNet.MVC.Controller from which your MVC controller and Web API controller should derive.

Dependency Injection and Middleware
Dependency injection is a technique that enables you to replace dependencies in your application with loosely-coupled pluggable components to make your application easier to test and maintain. ASP.NET Core provides support for dependency injection. Actually this support is built into ASP.NET Core.

Cross-platform capability
ASP.NET Core is a cross-platform framework for building modern Cloud-based and Internet-based applications. The earlier version of ASP.NET was targeted towards Windows operating system or, the Windows family of operating systems. On the contrary, ASP.NET Core supports multiple platforms, including Windows, Mac, and Linux. So, you can now build and deploy your applications on any of these platforms.