Microsoft designed the .Net Framework to work on Windows, the .Net 5 is .Net 3.1’s successor that offers a cross-platform experience to developers, and the .Net Standard brings APIs on preferred environments, such as mobile apps, desktops, and games.
Considering the variations in every .Net implementation, anyone can easily get confused between the differences and correct usage. For this reason, this article will map the difference in .Net Framework, .Net Standard, and .Net 5.0.
Full Framework / .Net Framework
.Net Framework was the initial work of Microsoft. This framework has been initially introduced in the year 2000 to build Web and Windows applications. There were many languages one can use while using the .Net Framework like C#, VB, F#, etc.
.Net Framework has evolved over the past 21 years with tons of functionalities added with each release. The latest available version of .Net Framework is 4.8.
It is also important to understand few key areas of .Net Framework which are as below,
Common Language Runtime(CLR)
The .Net Framework’s foundation is Common Language Runtime or CLR. With the help of this runtime code is managed at the time of execution. CLR is the one that provides core services like thread management, memory management through Garbage collection, remoting, etc. It also enforces safety, robustness, and security. CLR further consists of Common Type System(CTS) and Common Language Specification(CLS). These are responsible for type safety in the code. Due to the presence of CTS and CLS, cross-language communication is possible.
Base Class Library(BCL)
The Base Class Library or BCL contains a collection of object-oriented and reusable types utilized frequently for app development. This library is CLS-compliant and hence it can be accessed from all the languages supported by .Net Framework.
.Net Framework is multilingual. This means the developer can write the code in any language like C#, VB, F#, etc of his/her choice. This code is further compiled to a common language which is called Intermediate Language or IL. This is the language abstraction layer provided by Microsoft in .Net Framework to hide the complexity of the entire .Net system. This IL is further converted to machine-specific code through a process called Just-In-Time(JIT) compilation.
Below are the cases in which .Net Framework can still be used,
- ASP.Net pages are not included in any other Frameworks like .Net Core. Hence, to use ASP.Net Web Forms, one can use the .Net Framework.
- WCF is only available on .Net Framework.
- Windows Workflow is only available in .Net Framework.
- ADO.Net is only provided in .Net Framework.
Wondering if .Net Framework is still supported by Microsoft? Well, .Net Framework will still be supported – at least for a while. For further details on the official support policy of .Net Framework and schedule, refer here.
.Net Framework release by Microsoft provided a general platform for the development of server-based and desktop applications. The .Net Framework then was followed by a release of .Net Compact Framework which was used for the Mobile platforms. This was then followed by Silverlight, Windows 8 apps platforms, etc, added their own flavors of .Net Framework and runtime. These verticals for .Net Platforms involved associated base class libraries which were evolved over a period of time and these were delivered and maintained by separate teams in Microsoft.
For a developer, sharing a library code or a component developed in one platform required to re-implement the same and build it again for a specific platform though they were providing the same features. To address this problem, Microsoft introduced Portable Class Library.
Portable Class Library allowed for sharing of the code between the components. This is a re-usable library project where we can specify the target .Net platforms. For example, if you want to develop a library targetting the Silverlight and .Net Framework, the library would support those APIs that are commonly available in both of these platforms. In Visual Studio 2012, the Portable Class Library project was introduced as shown below,
While creating this project we can select the target platform as shown below,
Though the sharing of code between different platforms was achieved, it still had disadvantages like,
- Adding the support for the new platform was tedious because this involved not only the inclusion of the target framework but also to remove those API references which were not part of the target platform base class library.
- Portable Class Libraries didn’t have any control on the target platforms and they were still evolving separately.
This is where Microsoft came up with another approach using .Net Standard. The .Net Standard provided a set of APIs that should be implemented by all the platforms in order to remain .Net Standard complaint. Net Standard helps in defining the implementation of Base Class Libraries. This approach made it much easier to create libraries that work on all .NET platforms. The main goal of .Net Standard is to establish greater uniformity in the .Net ecosystem.
The .Net Standard is not a platform or framework by itself. It does not have a runtime or implementation, it just defines a specification. The relationship between .NET Standard and a .NET implementation is the same as between a browser and the HTML specification. The browser is an implementation of the HTML specification.
Framework Class Libraries (FCL) such as WCF, WPF, and ASP.NET are not part of the BCL. Hence, these are not included in .NET Standard.
Each .NET version has an associated version of the .NET Standard. Below is the table showing the .Net standard version and .Net implementation,
The table clearly shows that a later version of the listed implementation supports all the previous versions of the .Net standard. For example, .Net Core 2.0 supports not only the .Net standard 2.0 but also supports all the earlier versions too.
When choosing a .Net standard version, one has to consider the below points,
- The higher the version, the more APIs are available to your library’s code.
- The lower the version, the more apps, and libraries can use your library.
Microsoft recommends using the lowest version of the .Net Standard possible.
.NET Framework compatibility mode was introduced Starting with .NET Standard 2.0. This compatibility mode allows .NET Standard projects to reference .NET Framework libraries as if they were compiled for .NET Standard.
The .Net Standard has made it very easier to create libraries that work on all .NET platforms. However, there are still problems with .NET Standard which are as below,
- It versions slowly, which means the latest features can’t be used easily.
- It needs a decoder ring to map versions to .NET implementations.
- It exposes platform-specific features, which means you can’t statically validate whether your code is truly portable.
- Developers were confused with many platforms.
The release of the .Net 5 overcomes all these problems. Let us now understand the .Net 5 Framework.
.Net 5 is the huge release after the .Net Framework 4.8. The .Net 5 framework is a replacement of .Net Framework 4.8, .Net Core 3.1, and Xamarin, which offers a cross-platform experience to developers. The .Net universe has seen a wide fragmentation over the years, and .Net 5 adds new features to this fragmentation. Let’s see some of the critical things about .Net 5.
1. Unified Platform
As shown above, .Net 5 will provide the best-unified features of .Net Core, Mono, .Net Framework, and Xamarin to provide APIs, run-time & libraries to create the Windows, Mobile, IoT devices, and apps for Web. The goal of the .Net 5 is to empower unified .Net Client Application projects to create deliverables for various platforms including Linux, Legacy Windows, Droid, iOS, HTML5, Macintosh, Windows, and UNIX.
With these unified new features, developers will no longer need to choose between Mono, .Net Framework, and .Net Core. .Net 5, one SDK will rule them all.
To reflect the unification, the target framework names (TFMs) are updated as below,
- net5.0 – This is for code that runs everywhere. It combines and replaces the netstandard and netcoreapp names. This TFM will generally include technologies that work cross-platform.
- net5.0-windows (and later net6.0-android and net6.0-ios) – These TFMs represent OS-specific flavors of .NET 5 that include net5.0 plus OS-specific functionality.
You should think of net5.0 (and future versions) as the foundation for sharing code moving forward. Microsoft won’t be releasing a new version of .NET Standard, but .NET 5 and all future versions will continue to support .NET Standard 2.1 and earlier.
Since net5.0 is the shared base for all the new TFMs, the library, runtime, and new language features are coordinated around this version number. For instance, to use the features of C# 9.0, you need to use net5.0-windows or net5.0.
2. Improved C# Features
C# 9.0 is built over .Net 5 and you get many added features and benefits associated with it. Check these prominent features below:
- With the help of top-level statements, you can focus on essential things in a console utility or program eliminating all the boiler plate code.
- Another valuable addition is record types, which allow the declaration of an immutable reference. This means that you can’t change this class-based type once it is created. For example, if you make a System String class, you don’t have the freedom to modify its value.
There’s more to know about C# 9.0, you can check specific features here in our other article.
.Net Multi-Platform App UI or the MAUI that allows the building of user interfaces on macOS, Android, Windows, and iOS in one project. However, this exciting feature will be released in .Net 6, as it is still in design.
4. Single-File Support
The last important feature on our list for .Net 5 is single-file apps, which means you can make a single file for publishing and deploying your apps. Every dependency and the entire app is in one file. This eliminates the need for .Net runtime installation on the target machine.
However, it is imperative to note that this single-file feature doesn’t resemble .Net Core 3.1. Here, you can create a single-file package as a package of binaries. When you run it, this folder is converted to a temporary folder and then executed.
The single-file of .Net 5 is an entirely different internal structure executed without any penalty of performance.
For more detailed new features of .Net 5.0, visit here.
After briefly discussing the .Net 5, .Net Standard, and .Net Framework, you may have gained some clarity on the importance and features of every framework. These .Net frameworks are essential for the developer community due to their unique and unquestionably valuable features. Go through the features and benefits listed above and choose between .Net 5, .Net Standard, and .Net Full Framework.
For more details or assistance in software application development, you can connect with Desuvit Our years of experience have empowered us to offer state-of-the-art services in .Net Framework-based application development. Contact us if you need to know more.
Desuvit is a Norway-born software development company delivering Custom Software Development, Mobile Apps, and Web Applications Development for various verticals and business domains. We offer end-to-end solutions for companies with no software or IT division, Startups, and companies that need to scale their software development efforts but lack the expertise required. We help our clients in growing their businesses so we can grow with them. Some of the technologies we work with: .Net, Azure, Microservices, Azure functions(Serverless computing), React Native, Flutter, React JS, TypeScript, Angular, NServiceBus, Azure Service Bus, Azure Queues, SQL Service, MySQL, Cosmos DB, etc.
Enjoyed this article? Subscribe for more valuable and great content !