“.Net Standard is an API specification for a given version while .Net core is a framework that is optimized for building cloud, console, Asp.Net Core, and UWP applications. It’s nothing but an implementation of .Net standard for base class libraries.”
So, before digging deep inside what sets these three TMF’s apart, let’s get the basic concept cleared.
Whenever you create any C# project, you’ll be popped up with a .csproj file, which is nothing but your C# project file. Basically, these files have two versions:
1. Old format: It’s what you get by default with .Net framework projects.
2. New format: (SDK-style) – It’s something you get with modern .Net core projects.
The difference between these two is quite easy. Both are XML-based formats that have a “project” root element. In the SDK-style, .csjproj file, the “project” element has an SDK attribute and the old format doesn’t have that SDK attribute. Sounds pretty easy, isn’t it?
Though developers are working on the .net framework for ages, the difference between .net core and .net framework and .net standard still creates confusion. To eliminate those misconceptions, this blog highlights what are the basic differences between these terms and when we should use one over the other.
So, let’s get started.
What is the .Net framework?
.Net framework is used to build and manage web and windows-based applications. The old framework created by Microsoft leverages end-to-end solutions to create windows app typically knows and Win Forms and web applications like ASP.Net MVC app or ASP.Net.
What can be done with the .Net framework?
- Create and build a Windows application
- Being language-independent, it can use multiple languages.
- Build an app with good performance and highly reliable.
- Build web forms using Asp.Net, Rest API using Web API, and enterprise app using ASP.Net MVC.
What is .Net core?
Created by Microsoft, .Net Core is a cross-platform open-source framework used to build an app that can run on any platform. It’s a new framework written from scratch to build cross-platform apps that can work on any platform like Linux, Windows, or Mac. Earlier, the .Net framework was language independent but with the introduction of the .Net core, it is language and platform-independent.
What can be done with .Net core?
- Build cross-platform applications
- Deploy an application to Docker container
- Make use of Microservices
- Build and create a scalable, robust, and performance-driven system.
- Build Asp.Net core, UMP, Razor page, Mobile native app, and Blazor application.
Case Study: Understanding the architecture of the .Net framework and .Net core
So, before going deep inside the .Net standard, let’s understand the architecture of the .Net framework and .Net core.
The above image states that each one has its Base class library.
So, what’s the Problem?
For instance: Let’s assume that we build an app using the .Net framework and use its library for shared code. Later on, if we want to build an app in .Net core and try to re-use the same code in the library created in the .Net framework, can we do that?
The answer is NO. We cannot use the BSL in the .Net core due to compatibility issues. The libraries of the .Net framework only run in the .Net framework-based app and the .Net core libraries only run in the .Net core-based app.
What is the Solution?
The solution is the .Net Standard framework. It’s a specification of the set of APIs which is compatible with any .Net platform. If we create the BCL using .Net Standard, then it will run with any .Net Runtimes.
So, if you want to build an app and keep your shared code in BCL, you should use the .Net standard due to its portability with the .Net framework and ASP.NET Development Company
How .Net standard is backward compatible?
Well, the .Net standard consists of a set of APIs such as a system. data, system. collections and more. So, if a newer version of a .Net standard is released, it comes along with all the older versions of API along with the addition of some new ones. It simply means that the newer version of the .Net standard consists of all sets of APIs from beginning till the end and so a higher .Net standard version means more API availability.
As far as compatibility with another framework is concerned, you’ll find that the .Net standard supports a wide range of frameworks. You can check out the updated list of the framework support here.
This is how the .Net standard is backward compatible.
The major difference between .Net core, .Net framework, and .Net standard
. NET Standard
- The major difference between these three platforms is that the .Net standard is a specification while the rest two are implementations.
- .Net standard specifies a set of API’s that is suitable for implementation for all .Net implementation
- It only creates class library-type projects.
.NET Core and .NET Framework
- Unlike .Net implementation, .Net core and .Net framework are just .Net implementations
- Both the framework comprises the base class library.
- Both frameworks support multiple project type creation.
- These frameworks have a runtime engine that ensures the timely execution of the application.
When we should use one over the other?
Let’s discuss the points that need to be taken care of while choosing the target platform and its versions.
When you should choose .Net core?
- If you’re willing to build cross-platform applications
- To build scalable and high-performing systems
- For Microservice Development
- we want to use Docker containers
When you should choose the .Net framework?
- When your target application development is Windows-based.
- the app uses third-party packages that aren’t supported by .Net core
- When the app uses .Net technologies that are not available for .Net core.
When .Net standard should be your development choice?
In case you want to share the common code across different .Net implementations, the .Net standard should be your first and foremost choice.
So, once you choose the right platform and project type for your app, the next step would be to use the correct version. Let’s assume that if you want to share the common code across platforms then the .Net class library would be your choice. In such a case, choosing the correct version would be a bit difficult. The Microsoft version table will guide you to choose the best version.
I hope the above blog will help you to identify the difference between these three platforms and will guide you to choose the best as per your business requirements. Though multiple factors need to be considered while choosing the target platform and right version, an experienced ASP.NET MVC Development Company can help you in the process and guide you to make the right choice as per your business goals. Hire Asp.Net MVC developer from a leading ASP.Net development company like Concetto Labs and get the best solution developed at competitive rates.
Get in touch with our experts to discuss your project.
The Ultimate Cheat Sheet On .NET Core, .NET Framework, and .NET Standard
Manish Patel is a Co-Founder of Concetto Labs, a leading mobile app development company specialized in android and iOS app development. We provide a one-stop solution for all IT related services.