dnxcore50 vs dnx451 mistery



In the previous post I have configured ASP.NET 5.0 (or Core 1.0), but on mono and with dnx451,dnxcore50. But what is going on there?

Step by step

Last time I was using dnu,dnx, mono runtime and framework dnx451. It works fine. Let’s try to use other things.

dotnet build

This fails with a lot of errors:

Compiling shout for 
/usr/share/dotnet/bin/dotnet compile-csc @/home/mogluszka/Sources/shout/src/shout/obj/Debug/dnxcore50/dotnet-compile.rsp returned Exit Code 1
/home/mogluszka/Sources/shout/src/shout/project.json(6,40): error NU1001: The dependency Microsoft.Win32.Primitives >= 4.0.0 could not be resolved.
/home/mogluszka/Sources/shout/src/shout/project.json(6,40): error NU1001: The dependency System.AppContext >= 4.0.0 could not be resolved.
/home/mogluszka/Sources/shout/src/shout/project.json(6,40): error NU1001: The dependency System.Collections >= 4.0.11-beta-23516 could not be resolved.

The reason behind is the first line. It’s trying to compile this code with .NET Core stuff, which is not supported by framework chosen in project.json:

  "frameworks": {
    "dnx451": { }    

What would happen if I’d change it tu dnxcore50? It will fail.

error: System.Diagnostics.Debug 4.0.11-beta-23516 provides a compile-time reference assembly for System.Diagnostics.Debug on DNXCore,Version=v5.0, but there is no run-time assembly compatible with ubuntu.14.04-x64.

Reason? Because I’m still using mono runtime!
How about using dnx?

$dnu restore
$dnu build
$dnx kestrel

Surprisingly first two are working. Last one fails with more reasonable error:

mogluszka@mogluszkaW540:~/Sources/shout/src/shout$ dnx run
System.InvalidOperationException: The current runtime target framework is not compatible with 'shout'.
Current runtime target framework: 'DNX,Version=v4.5.1 (dnx451)'

So regardless which execution framework we will use, we still get same problem.
Ok, so we will change runtime.

mogluszka@mogluszkaW540:~/Sources/shout/src/shout$ dnvm use 1.0.0-rc1-update1 -r coreclr
Adding /home/mogluszka/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-rc1-update1/bin to process PATH
mogluszka@mogluszkaW540:~/Sources/shout/src/shout$ dnvm list

Active Version              Runtime Architecture OperatingSystem Alias
------ -------              ------- ------------ --------------- -----
  *    1.0.0-rc1-update1    coreclr x64          linux           
       1.0.0-rc1-update1    mono                 linux/osx       default

How about now?

$dnu restore
$dnu build
$dnx kestrel
Hosting environment: Production
Now listening on: http://localhost:5000

Works like charm!

The problem is that dotnet build still fails with the same issue? What is wrong? This is something still to discover…

Things to remember


  • dnx451, dnx46 are “equivalents” of .NET Framework 4.5 and 4.6
  • both of them are running only on mono, so it’s different on Windows and Linux


  • dnxcore50 is whole new think which is cross platform
  • it’s running on coreclr runtime (same on Windows and Linux)

Leave a Reply

Your email address will not be published. Required fields are marked *