⚙ .NET Implementations
.NET is a managed software platform which allows to run the same compiled program code on multiple hardware-platforms and operating systems. The way this works is that the source-code gets compiled to a special byte code called “Intermediate Language” (IL). On the consumer’s device behind the scenes this IL code gets compiled to machine code by the “Just In Time compiler” (JIT), and finally executed.
This post only covers .NET implementations/concepts that are still relevant for current desktop-, web- and mobile-app-development and does not claim to be exhaustive.
🕰 Short History
- 2002-2021+: .NET Framework 1.0 – 4.8
The “classic” .NET everyone used to think of, Windows-only
- 2004-2021+: Mono
The open source implementation of .NET Framework, supports Windows, MacOS, Linux, Android, iOS,…
- 2015-2020: .NET Core 1.0 – 3.1
Completely new implementation of .NET Framework, cross-platform, huge performance boosts
- 2020+: .NET 5.0+
Actually .NET Core renamed, “unified .NET”, cross-platform UI, huge performance boosts
Noteworthy General Features
- 💪 Intermediate Language (IL) for multi-platform support
- 💪Just In Time Compiler (JIT) for multi-platform support
- 💪 Strongly typed (optional dynamic typing)
- 💪 Rich built-in standard library
- 👌 Exception-Handling
- 🤠 Reflection
- ❤ Generics
- ❤ Extension Methods
- ❤ Language Integrated Query Language (LINQ)
- ❤ Lambda Functions/Expressions
- ❤ NuGet (Package Manager)
🧓 .NET Framework
The original implementation of .NET which was first released 2002. You can take a look at its source code under the “only-look” Microsoft Reference Source License.
- 👀 Microsoft Reference Source License (“look-only” license)
- 📦 Built into Windows
- 🔄 Updated via Windows Update
- ⚠ In maintenance mode
Today it is effectively in maintenance mode. Microsoft announced that .NET Framework will be supported as long as Windows will be supported – read: forever. But since 4.8 only bugfixes and security-updates will be provided. New features and innovations will go into “.NET”, as its successor is simply called.
Mono is the open source implementation of .NET Framework first released in 2004. It was started by Miguel de Icaza who until this day is part of this project and works at Microsoft. It’s still in active development, unlike .NET Framework.
- ❤ MIT license (real open source)
- 💪 Huge platform support
- 🚀 AOT support (compile to fast, native code)
- 👨💻 Official supported by Microsoft
- ℹ Soon part of .NET (see below)
Mono enables developers to develop .NET GUI apps for desktops, smartphones, smartwatches and TVs. Noteable mentions are iOS, Android and MacOS.
In the first years Microsoft was fighting Mono with copyright claims, but in 2006 Microsoft and Novell – Mono’s owner at the time – settled this with agreements. Finally, in 2016 Microsoft bought Xamarin, the company developing Mono at the time and fully embraced it within their .NET tooling and platform.
Mono will be unified with .NET under the name .NET 6 in November 2021.
📦 NuGet – Package Manager For .NET
NuGet was introduced in 2010 as a Visual Studio extension to add libraries from an library-server to your projects instead of copying DLL-files around.
- 👍 Default way of including libraries into own projects
- 👌 Versioned
- 🌍 Browse packages on nuget.org
- ⚠ packages.config file is deprecated
- ✔ PackageReference in .csproj-files is the new way of including NuGet packages
Initially NuGet used a separate XML-file called packages.config to store referenced NuGet packages information. This is now deprecated and superceded by PackageReferences inside of .csproj-files. This has the benefit of being better integrated with the build toolchain and therefore causes less problems.
Visual Studio provides a nice UI for easily managing NuGet installed packages of your solutions/projects.
📱 Xamarin – and .NET MAUI
Enables you to develop Android, iOS, Windows and Mac apps with .NET. It is built on top of Mono.
- 🤝 Brings .NET to iOS and Android, and also Windows and MacOS
Part of Xamarin is Xamarin.Form which provides you with a MVVM framework working on all supported devices. Think of it as the “Crossplatform WPF“.
Unfortunately it has its own dialect of XAML which is slightly but noticeably different that the original WPF one.
Coming with .NET 6 Xamarin.Forms will be superseded by .NET MAUI – the refactored/improved version of Xamarin.Forms.
🤝 Portable Class Libraries
Before .NET Core (see below) came around, writing cross-platform apps was already somewhat possible. But due to .NET Framework being designed for Windows, its API was to some extend Windows-specific. But calling a Windows API on Android would make no sense or cause an error. So the Portable Class Library concept was introduced.
- 🤝 First library multi-targeting attempt
- ⚠ Deprecated
- ℹ Superceded by .NET Standard
Portable Class Libraries (PCL) specified sub-sets to the Base Class Library that developers were allowed to use. Those sub-sets were called “profiles”, which were predefined by Microsoft. If you wanted to run shared code on selected platforms with limited BCL implementations – i.e. Android apps and Windows 8 apps – then you would need to select the right profile at the project level.
It followed the concept of the least common denominator: if 1 from 5 target platforms did not support an specific API, the developer could not use this API on any platform. This way, writing library code was more and more difficult as even heavily used APIs would end up being filtered out.
Nowadays you can practically forget about it, but its successor, .NET Standard, is still relevant today.
⚡ .NET Core
In 2015 Microsoft started to reimplement .NET Framework under the name .NET Core. The reason were slow advancements in terms of performance and efficiency due to compatibility concerns and being actually part of Windows itself. And it only ran on Windows.
This should all be overcome by .NET Core.
- ❤ MIT license (real free open source)
- 💪Side-by-side installation
- 💪 Extremely faster, vastly reduced memory allocations (see .NET 5 anouncement post)
- 💪Improved software stacks (ASP.NET Core, Entity Framework Core,…)
- 🔄 Not pre-installed on Windows, but updated via Windows Update if installed
First off: .NET Core is cross-platform: it runs on Windows, Linux, MacOS – with official support from Microsoft.
With .NET Core Microsoft was able to break free from aforementioned restrictions. .NET Core versions can be installed side-by-side, and programs can even be self-contained, not requiring a global .NET Core install at all. So backward-compatibility issues are not a problem anymore, as they can be worked around by the developers.
This also enabled and still enables huge performance improvements, version by version. It’s often more than 2x as fast as the latest .NET Framework 4.8, sometimes even almost 100x! This is possible due to allocation free code-path rewrites, more efficient memory access patterns, and fixing longstanding (yet strange) bugs, as there are no customers with old software relying on these bugs.
The 1.x versions only supported a subset of the pre-existing .NET Framework Base Class Library (BCL), limiting its usefulness.
Since 2+ the full (non-GUI) BCL is supported, which made using it with pre-existing libraries and source-codes in most cases a breeze (read: no source code changes).
From version 1.0 to 2.1 .NET Core only supported console- and web-apps.
In 3.0 support for WPF and WinForms GUI apps was re-added – but Windows only.
🤝 .NET Standard
To bridge the gap in supported Base Class Library APIs between .NET Framework, Mono, and .NET Core, the .NET Standard concept was introduced.
- 🤝 Bridges .NET Framework, Mono and .NET Core/.NET
There are multiple versions of .NET Standard, specifying an API surface supported by specific implementations of .NET, like .NET Framework, Mono and .NET Core.
Nowadays there are only 2 versions of .NET Standard relevant:
- .NET Standard 2.0
- .NET Standard 2.1
.NET Standard is widely used for library projects that should run on newer .NET Core 2.0+/.NET 5 and older .NET Framework 4.7.x (4.6.1 support is buggy).
It’s important to note that with unified .NET, .NET Standard itself is going to disappear slowly. As the usage of .NET Framework and previous .NET Core versions will be further declining, more and more software projects are either started on .NET 5+ or being migrated to it.
The first version of .NET was introduced as .NET 5.
Instead of naming the successor of .NET Core 3.1 “.NET Core 4”, Microsoft went with “.NET 5”. Removing the “Core” suffix is due to
- Microsoft’s ambition to unify .NET Core and Mono under one .NET
- and signaling that .NET 5 is the main implementation of .NET
- 😎 “The .NET” going forward
- 🙃 Rebranded .NET Core
- 💪 Single file publish (improved)
- 🤩 Further improved performance (3rd party test)
- 🤩AOT support (coming with .NET 6)
- 🤯 Hot-Reload alias “Edit your code while it is executing” (coming with .NET 6)
- 🤩 Supports even in Blazor SPAs running on Web-Assembly
See here to find an official introduction into .NET 5.
🎓 Learn .NET
Interactive coding tutorials with videos of the glorious (and often hilerious) Scott Hanselman.
People To Follow
If you want to know which nice people in .NET space you can follow, check out my next post .NET People You Should Follow.