Sunday, April 5, 2015

What is .NET Core

We have been using .NET framework since 2002 (.NET Framework 1.0) which was released along with Visual Studio 2002. It has amazingly evolved over time and as of today, we are in the age of .NET 4.6 Preview which was initially released with Visual Studio 2015 Preview. Last November, being specific, 12th November 2014, along with the .NET 4.6, Microsoft has announced another framework which is .NET Core.

So what’s this .NET Core? Let’s find out.

If you have a look at the following picture, you should be able to get a basic understanding of how .NET framework is structured.
3173.Pic1
Overview of .NET Framework
The .NET framework is a collection of set of verticals such as Windows Desktop, Windows Store, Windows Phone, ASP.NET 4 etc. and for each these verticals there are different Base Class Libraries (BCL) and runtimes (for Windows Desktop and ASP.NET 4, basically it’s the same framework and runtime). Some libraries are available in one vertical and those same libraries are not available in other. Best example for this scenario would be Windows Store and Windows Phone. Isn't it great if we can have a single Base Class Library, that can be used across every vertical/application model regardless of the application model and the operating system that the application runs upon.

And that’s where the .NET Core comes in.
image
Overview of .NETCore
In simple, .NET Core is a framework which includes all the core and primary libraries which is available in all the different Base Class Libraries in .NET full framework. So with .NET Core there will be no different Base Class Libraries, there will be only one unified BCL which can be used in Windows Desktop, Windows Store etc. application models and most importantly it can run on Windows, OS X and Linux. Here there is a runtime adoption layer, that’s because for Windows 10 Universal apps, the runtime will be .NET Native and for ASP.NET 5 on .NET Core, the runtime will be Core CLR.

Another things is, the .NET Framework is a machine-wide framework. Any changes made to it affect all applications taking a dependency on it. If you upgrade the .NET Framework version in your machine, there is no 100% guarantee that applications which targets the old frameworks still works.

.NET Core answers this question by giving the ability to be shipped via NuGet. That means you can ship a private version of the .NET Core Framework with your app. Other apps' versions can't change your app's behavior. Here the nice thing is, the entire .NET Core platform is not distributed as a single NuGet package. Instead, it’s a set of fine grained NuGet packages. In simple with the .NET Core, you are building your own framework.

Now let’s see .NET Core in action. For that, let’s create an ASP.NET web application using Visual Studio 2015.

When you try to create a ASP.NET application using Visual Studio 2015 targeting .NET Framework 4.5 or above, you will see following project templates.
image
New Project
Let’s move forward selecting an ASP.NET Web Application and  you will be thrown with the following dialog. There let’s choose ASP.NET 5 Empty and click on OK.
image
New ASP.NET Project
Once we do that, a new ASP.NET Web Application will be created and it is slightly different to ASP.NET 4 or below Web Application project templates. There is no longer a web.config file, instead there is a project.json file. Under the solution explorer if you  expand the References node, there you will see the following.
image
ASP.NET 5.0 and ASP.NET Core 5.0
There you should be able to see ASP.NET 5.0 and ASP.NET Core 5.0. In here basically ASP.NET 5.0 will be running on top of .NET Framework 4.5 and ASP.NET Core 5.0 will be running on top of .NET Core 5.

For more information on .NET Core,
Happy Coding.

Regards,
Jaliya

No comments:

Post a Comment