DotnetFramework Vs DotnetCore
DotnetFramework Vs DotnetCore
Net Core
.Net Framework introduced officially in 2002 that was supporting only Windows as an operating
system. In 2016 Microsoft upgraded the .Net Framework to an opensource development
environment and runtime called .Net Core.
.NET Core is the latest general purpose development platform maintained by Microsoft. It works
across different platforms and has been redesigned in a way that makes .NET fast, flexible and
modern. This happens to be one of the major contributions by Microsoft. Developers can now build
Android, iOS, Linux, Mac, and Windows applications with .NET, all in Open Source.
In this chapter, we will cover .NET Core and a few new innovations including the .NET Framework
updates, .NET Standard, and Universal Windows Platform updates, etc.
1. Open source
.NET Core is an open source implementation, using MIT and Apache 2 licenses.
As an open source project, it promotes a more transparent development process and promotes an
active and engaged community.
2. Cross-platform
Application implemented in .NET Core can be run and its code can be reused regardless of your
platform target.
Windows
Linux
MacOS
The supported Operating Systems (OS), CPUs and application scenarios will grow over time, provided
by Microsoft, other companies, and individuals.
3. Flexible deployment
4. Framework-dependent deployment
5. Self-contained deployment
6. Command-line tools
7. Compatible via the .NET Standard Library
8. Modular
.NET Runtime − It provides a type system, assembly loading, a garbage collector, native interop and
other basic services.
Fundamental Libraries − A set of framework libraries, which provide primitive data types, app
composition types and fundamental utilities.
Software Development Kit (SDK) & Compiler − A set of SDK tools and language compilers that enable
the base developer experience, available in the .NET Core SDK.
‘dotnet’ app host − It is used to launch .NET Core apps. It selects the runtime and hosts the runtime,
provides an assembly loading policy and launches the app. The same host is also used to launch SDK
tools in much the same way.
Let's understand the execution process of .NET Core and compare it with the .NET Framework. The
managed execution process includes the following steps.
Choosing a compiler
Compiling your code to MSIL
Compiling MSIL to native code
Running code
Choosing a Compiler
It is a multi-language execution environment, the runtime supports a wide variety of data types and
language features.
To obtain the benefits provided by the common language runtime, you must use one or more
language compilers that target the runtime.
Compiling translates your source code into Microsoft Intermediate Language (MSIL) and generates
the required metadata.
Metadata describes the types in your code, including the definition of each type, the signatures of
each type's members, the members that your code references, and other data that the runtime uses
at execution time.
The runtime locates and extracts the metadata from the file as well as from framework class libraries
(FCL) as needed during execution.
At execution time, a just-in-time (JIT) compiler translates the MSIL into native code.
During this compilation, code must pass a verification process that examines the MSIL and metadata
to find out whether the code can be determined to be type safe.
Running Code
The common language runtime provides the infrastructure that enables the execution to take place
and services that can be used during execution.
During execution, managed code receives services such as garbage collection, security,
interoperability with unmanaged code, cross-language debugging support, and enhanced
deployment and versioning support.
Now let’s relate how code executes with .NET Core as compared to .NET Framework. In .NET Core
there are many replacements of these components that are the part of the .NET Framework.
In .NET Core now we have a new series of compilers, like we have Roslyn for C# and VB.
You can also make use of the new F# 4.1 compiler if you want to use F# with .NET Core.
Actually these tools are different and we can use Roslyn with .NET Framework as well if we
are using C# 6 or later, because C# compiler can only support up to C# 5.
In .NET Core, we don’t have a framework class libraries (FCL), so a different set of libraries
are used and we now have CoreFx.
CoreFx is the reimplementation of the class libraries for .NET Core.
We also have a new run time with .NET Core known as CoreCLR and leverages a JIT
Compiler.
Now the question is why do we have the reimplementation of all these components that we
already have in .NET framework.
So the answer is the same as why Microsoft implemented .NET Core.
lllll