Let’s start by posing some fundamental questions.
What is .NET Core?
.NET Core is a fast, modular, cross-platform, and open source platform for developing general purpose applications. Currently, it supports console apps, Libraries, Web Applications/Services, Windows 10 UWP and Xamarin forms.
.NET Core includes .NET Core, ASP.NET Core and Entity Framework Core. These products are actively developed by the .NET team and in collaboration with a community of open source developers
The characteristics given below best define .NET Core.
.NET Core is completely modularized. Each component is distributed via NuGet. Also, assembly can be updated independently and does not rely on major framework releases.
Runs on Windows, Mac-OS and Linux; the supported operating systems list can be found at GitHub.
- Command-line tools
All product scenarios can be exercised at the command-line. For example, dotnet new , dotnet build, dotnet restore, dotnet run etc.
.NET Core is compatible with .NET Framework, Xamarin and Mono, via the .NET Standard Library. It supports full side by side execution to make it easy to adopt new .NET Core versions without affecting other apps.
- Open source
.NET Core platform is open source, using MIT and Apache 2 licenses. Documentation is licensed under CC-BY. .NET Core is a .NET foundation project.
- Supported by Microsoft
.NET Core is supported by Microsoft, as per .NET Core Support. (It is the same confidence as Google supported Angular).
What does .NET Core contain?
The .NET Core platform is made of several components, which includes the managed compilers, the runtime, the base class libraries and Application models such as console apps, ASP.NET MVC & API apps.
.NET Core comprises of the parts given below.
- .NET runtime (CoreCLR), which provides a type system, assembly loading, a garbage collector, native interop and other basic Services. .NET Core runtime includes the same GC and JIT (RyuJIT), but doesn’t include features like Application domains or Code Access Security.
- Framework libraries (CoreLibrary), factored base library (removal of dependencies) to provide primitive data types, app composition types and fundamental utilities.
- SDK tools and compilers (CoreSDK) that enables the base developer experience for ex. CLI tools and ‘dotnet’ app host, which is used to launch .NET Core apps.
.NET Core Versioning
.NET Core is not the name of the product, which was started initially. However, the changes are big and it’s almost re-writing from scratch. Hence, it makes more sense to rename them. In the screenshot given below, the left side shows the old name and corresponding new names are on the right.
.NET Core compilation process
Now, let’s look at .NET Core compilation process, as it’s different from traditional processes.
.NET Framework Vs .NET Core
.NET platform was first announced by Microsoft in 2000 and then evolved. .NET Framework has been the primary .NET product produced by Microsoft during a 15+ year span.
Before comparing them, let me tell one thing — .NET Framework (4.x) is still very much alive and should be used for any existing Workloads. It’s a time tested Framework for the Windows environment.
Also, there are some Workloads (WPF/Win Forms/Web Forms etc.) which can only be run in traditional .NET Framework. The image given below explains this.
The major differences between .NET Core and .NET Framework are given below.
.NET Core does not support all .NET Framework app-models in part because many of them are built on Windows technologies, such as WPF (built on top of DirectX). Console and ASP.NET Core app-models are supported by both .NET Core and .NET Framework.
Currently .NET Core contains few APIs compared to .NET Framework as it typically requires changes to port source to .NET Core. However .NET Core implements .NET Standard Library API, which is still growing to include more .NET Framework BCL API.
.NET Core implements a subset of the subsystems in .NET Framework with the goal of a simpler implementation and programming model. For example, Code Access Security (CAS) is not supported, while the reflection is supported.
.NET Framework supports Windows and Windows Server while .NET Core also supports mac-OS and Linux.
- Open Source
.NET Core is fully an open source, however only a read-only subset of .NET Framework is an open source.
When to use what?
Now, the classic questions comes about use cases that when should I go for Core or when with traditional framework.
Workloads, where it can’t be used:
- WPF, WinForms, unless UWP.
- NET Web Forms.
- Anything Windows-specific: registry, ACLs, perf counters.
Workloads where it can be used (with some re-writing):
- NET MVC
- Console apps
Workloads where it should be used
- General purpose libraries