.NET core : Build and run in any platform.


Build And Run The .NET Core In Any Platform
In the previous version of .NET framework, we have ASP.NET for web application and WPF/Winform for windows application. This web and windows applications only run on windows. However , there are some opensource framework like Mono which helps us to port the .NET code into Linux and other operating systems. By the help of Mono we can run .NET on other operating systems. However, large business people won’t not prefer this because it has no Microsoft brand. In mobile world we can write .NET code for Windows Phone but the market leaders are Android and IOS. Our .NET framework is almost 15+ years old so .NET framework does not know about Android , IOS , Linux etc. So Microsoft rebuilds the .NET framework and introduced new framework called .NET core.

Overview of .NET Core

NET Core is portable across platforms because, although a subset of the full .NET Framework, it provides key functionality to implement the app features you need and reuse this code regardless of your platform target. .NET core will be available on Linux and Mac operating system.
What Microsoft peoples did is , they took the .NET framework and extract the core code (Only related to garbage collector , CLR , CTS , code access security etc) and went to Github and created separate repositories . If you open the coreclr repository you can see separate build for each platform. Another repository called CoreFx which includes classes for collections, file systems, console, XML, async and many others. These changes helps us to run .NET Core on other platform but Visual Studio runs only on Windows so how we can develop applications in other platform ? That is the reason why Microsoft introduced DNVM , DNU and DNX

.NET core CLR repository

What is DNVM , DNU and DNX ?

DNVM is the .NET Version Manager. It is basically a set of command line instructions which allow you to configure your .NET Core Runtime.

We can install DNVM in two ways.
1) Install the DNVM using the following command from CMD prompt.

@powershell -NoProfile -ExecutionPolicy unrestricted -Command&{$Branch=’dev’;iex ((new-object net.webclient).DownloadString 
(‘ https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1‘))}

2) Install the DNVM using the following command from Powershell

&{$Branch=’dev’;iex ((new-object net.webclient).DownloadString 

DNVM in .NET Core
DNU stands for DNX Utility. This is similar to the ‘Library Package Manager’ in visual studio. This helps in reading all the dependencies of our respective project and downloads it.

DNX stands for the Dot Net Execution Environment. This is a runtime which includes the code needed to bootstrap and run our applications for windows, MAC and LINUX.

The following two tabs change content below.

Tom Mohan

Tom Mohan is a technologist who loves to code and build. He enjoys working on Microsoft Technologies. Tom specializes in ASP.NET MVC, Web API , Azure, C# ,WPF, SQL etc and holds a Bachelor engineering degree in Computer Science. Certification : MCSD , MCTS

Latest posts by Tom Mohan (see all)