I’m writing this blog after we have done several projects (some of them were commercial, some internal) with these technologies at Tesseris Pro and discovered a lot of things that are not covered by documentation.
Let’s try to understand the place of every project on the global picture
Many of us already know about new version of .Net. There are a lot of resources saying that it will be open source, will run on Linux and OS X without mono and a lot of other things. And some statements can disappoint because they conflict with each other.
Let’s review available projects
- .Net Core (http://dotnet.github.io)
- ASP .Net vNext (https://github.com/aspnet/home, https://www.asp.net/vnext, https://docs.asp.net/en/latest/)
- DNX (https://github.com/aspnet/dnx)
- Mono project (http://www.mono-project.com/)
At first let’s understand what DNX and .Net Core are and how they relate to each other.
- DNX is a Dot Net Execution Environment. As ASP.Net vNext says it’s “…a software development kit (SDK) and runtime environment that has everything you need to build and run .NET applications for Windows, Mac and Linux … DNX was built for running cross-platform ASP.NET Web applications…”. And that’s right with dnu (Dnx utility) you can build projects.
- .Net Core is a “… cross-platform implementation of .NET that is primarily being driven by ASP.NET 5 workloads… The main goal of the project is to create a modular, performant and cross-platform execution environment for modern applications.”(see .Net Core)
Hm… two projects from MS with the same goals and the same features. And yes that’s true DNX and .Net Core currently give us almost the same functionality. And these two sites together with ASP.Net and VS Code web site bring a lot of misunderstanding about what the next .Net next version is. What is the reason for it? The answer is here (https://github.com/dotnet/cli/blob/master/Documentation/intro-to-cli.md) “We’ve been using DNX for all .NET Core scenarios for nearly two years… ASP.NET 5 will transition to the new tools for RC2. This is already in progress. There will be a smooth transition from DNX to these new .NET Core components.” Looks like DNX will be replaced by tools from .Net Core.
Ok what about .Net Framework 4.6 and Mono? .Net Framework (https://www.microsoft.com/net) will continue its evolution as framework with WPF and other windows specific stuff and it will be compatible with .Net Core. It means that it will not duplicate core functionality but instead of it will offer additional services. And as it was before most interesting things like WPF will be only MS Windows compatible. The same story with mono I think.
.Net Core – set of cross-platform tools to build applications, cross-platform execution tools, set of cross-platform core libraries (like System, System.Runtime, System.IO, etc.)
DNX – obsolete (at least for ASP .Net 5) set of cross platform tools and runtime environment almost the same feature-set as in .Net Core
.Net Framework – set of libraries to develop windows desktop and web application some of assemblies may be cross-platform as far as assembly format is the same in all described technologies.
Mono – set of libraries that partially replaces .Net Framework under Linux and OS X, execution tools and build tools.
Assembly format is the same so mono can execute Core or Framework assembly and vice versa. The most significant problem except P-Invokes to Win API is references. Currently all described frameworks have different functionality distribution across assemblies. So sometimes you will not be able to start application because application will search for class C in assembly A, but in actual runtime class C will be located in assembly B.
Some additional notes about build tools
Both .Net Core and DNX have new project file format project.json. It aimed to use file system structure as project structure and allows to build application for different platforms at the same time. As result you will have set of assemblies that are referencing correct assembly for every class.
Both tools work on Linux and OS X (OS X was not tested by me yet).
One of significant problems is debugging under Linux now. To debug application we need .pdb (.mdb) file that binds binary assembly with source code files. DNX tools are not able to produce any debug files, .Net Core tools can produce *.pdb files but VS Code and MonoDevelop need *.mdb under Linux to debug. So now it’s better to use mono under Linux if you would like to debug 🙂 Even if you are going to use VS Code.
One of important things is that .Net Core build tools can produce native small Linux executable to start application without “mono app.exe”.
My next blog will be about build tools and how to setup build environment under Linux.