Microsoft are doing some amazing things these days, no more so than the open-sourcing of software but also adopting the development processes of the open-source communities. The introduction of dnvm, dnu, dnx command line utilities are amazing, and reflections of what we have seen in the Ruby and Python community for the longest time. I’ve been about 2 years away from the Microsoft world, embedded in the world of Ruby and there is so much to be said about the language and it’s friendliness towards developers, but perhaps in another post. For today, let us turn our attention to some of the command line utilities that are now available on your Mac (or OS X) to begin your .NET journey. These utilities are available on Linux and Windows as well, so you should have similar experiences.
DNX- The .NET Execution Environment
“The .NET Execution Environment (DNX) is a software development kit (SDK) and runtime environment that has everything you need to build and run .NET applications for Windows, Mac and Linux. It provides a host process, CLR hosting logic and managed entry point discovery. DNX was built for running cross-platform ASP.NET Web applications, but it can run other types of .NET applications, too, such as cross-platform console apps.”
I think the explanation from the ASP.NET website is pretty clear, but DNX on the command-line more specifically will grant you the ability to “bootstrap” your application for self-hosting. That’s pretty impressive, given that historically one would have to get IIS up and running. Below you can see that I have fired up my application and it is now running on port 5000.
The CoreCLR is the .NET execution engine that performs functions like garbage collection and compilation to machine code. The github repo for the CoreCLR describes it’s function as – “This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.”
CoreFX is the library implementation for .NET Core (that is the cross-platform implementation of .NET) that is primarily driven by ASP.NET 5.
So DNX by way of definition in terms of SDK (as stated above) contains the CoreCLR and base parts of CoreFX .
DNU – The .NET Development Utility
DNU is used to manage the dependencies or the packages required for your project. DNU reads the package.json file included in your project and manages it’s dependencies from the runtime version to required packages all via NuGet. With it, you can list packages, install/uninstall the application, publish the application for deployment and restore packages. Very handy!
DNVM – The .NET Version Manager
“DNVM lets you list the different DNX versions and flavors on your machine, install new ones and switch the active DNX”.
DNVM is similar to Ruby’s RVM, that is, it allows you to download different versions of the .NET execution environment, manage them and set the default (as per below).
All in all, .NET has come to Mac and it’s ABOUT TIME 😉
Further reading and references: