The .NET Framework comes to mind when talking about .NET. However, since the release of .NET Core 1.0 in 2016, we need to be more specific and distinguish between the .NET framework (also referred to as the full .NET framework) and the new .NET Core.
To understand the differences between the two, we first need to inspect the two main parts of the .NET framework: Common Language Runtime (CLR) and the Framework Class Library (FCL).
The Common Language Runtime is the virtual machine part of the .NET framework, responsible for running applications. It provides multiple services which make the following possible:
- The just-in-time (JIT) compiler converts the compiled IL (intermediate language) code from .NET application binaries packaged as assemblies, into machine code for the CPU on which it is currently running.
- The garbage collector (GC) handles memory management. .NET applications need not allocate and release memory themselves. The garbage collector automatically releases all the unused objects from memory.
- Thread management allows applications to use multiple threads to improve their scalability and performance.
- Exception handling provides the structure required for throwing exceptions as well as the hierarchical handling of exceptions in applications.
- The Common type system (CTS) is the basis for interoperability between the components developed in different programming languages and compiled into the same IL code.
The Framework Class Library is the toolset for effectively building .NET applications. At its core is the Base Class Library (BCL) – a set of low-level classes for common operations, such as math, string manipulation, I/O operations etc. On top of it are other frameworks, specific to building different types of applications: Windows Forms and Windows Presentation Foundation (WPF) for desktop applications, ASP.NET Web Forms and ASP.NET MVC for building web applications, Windows Communication Foundation (WCF) and ASP.NET Web API for building web services, etc.
Since version 1.0, three updates of Common Language Runtime were released (1.1, 2.0 and 4.0) as well as several .NET framework updates (3.0, 3.5, 4.5…) without its own CLR version, which mostly expanded and updated the Framework Class Library.
.NET Core is a complete reimplementation of the .NET framework. Microsoft designed it with several differences compared to the .NET framework:
- Unlike the .NET framework, which was only built for the Windows operating system, .NET Core CLR is cross-platform, with implementations available for Windows, Linux and macOS.
- It is fully open source, licensed under MIT and Apache 2 licenses. It is developed in the public and accepts external contributions. This gives it the potential of supporting even more operating systems and CPU architectures in the future.
- The .NET framework can only be installed as a component of the operating system, allowing only two versions of the .NET framework to be present on a machine (one for CLR 2.0 and one CLR 4.0) . Updates to any of the versions affect all installed .NET applications. On the other hand, .NET Core can be deployed as a part of the application itself. This allows different versions of .NET Core to be installed side-by-side, making it possible for an application to keep running on the same version of the runtime, even if the runtime is updated for other applications.
- The development tools for .NET Core are not tightly bound to Visual Studio. All operations can be performed using command line tools. This makes it easier for other editors and integrated development environments (IDEs) to provide some level of support for .NET Core development, and also gives more control to developers for automating different steps in the development process according to their needs and preferences.
- A lot of attention is given to performance characteristics of the runtime. In the age of microservices and containers, small footprint and quick startup times are much more important than they used to be. Great performance is a prerequisite for .NET Core to be competitive with other frameworks like Node.js or Django.
All though the assembly formats are compatible between the .NET framework Common Language Runtime (CLR) and the .NET Core CLR, .NET framework applications still can’t simply be run under .NET Core. Not only do the entry assemblies need to be recompiled to target a different runtime, but there are also differences in the class libraries.
.NET Core includes only a subset of the .NET framework’s Framework Class Library. Although the class library size has more than doubled in .NET Core 2.0, it is still mostly limited to the BCL only.
.NET Core includes only a very limited number of application frameworks:
- ASP.NET Core is a re-implementation of ASP.NET MVC and ASP.NET Web API from the .NET framework. Although the basic concepts are still the same, existing applications can’t simply be migrated to the new framework. They need to be rewritten. ASP.NET Core is also available for the .NET framework, so that applications written in it can theoretically run on either runtime.
- The only other currently supported application type are console applications. Old .NET framework console applications can be recompiled for .NET Core without changes as long as they do not have other dependencies, which are not available in .NET Core.
- When .NET Core 3.0 gets released in 2019, support will be added for Windows
Forms or Windows Presentation Foundation (WPF) based Windows desktop applications. Both application models will support hosting of Universal Windows Platform (UWP) controls including modern browser and media player components.
.NET Core implementations of all three UI frameworks are open sourced, similar to the rest of .NET Core.
The current state of .NET Core therefore makes it suitable for writing new web applications and REST services using ASP.NET Core. Unless they have very specific dependencies which are still not supported in .NET Core and can’t be moved into standalone services, the benefit of migrating to .NET Core will be better performance and the ability to run the application on operating systems other than Windows.
The same can probably be said for console applications. For any other types of desktop applications though, .NET frameworkis still the only available option. At least, until the release of .NET Core 3.0.