1

When you create a new project in Visual Studio 2015 based on the ASP.NET project template you get the following frameworks element in project.json

"frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

If you add a class library to the solution the frameworks element look like this:

"frameworks": {
    "dotnet": { }
  }

Now what are these different frameworks and do I need all of them? for example if I want this library to access data from sql server can I use dnx451 or I have to use dotnet?

In earlier versions of ASP.NET 5 it was advised to get rid of dnxcore50. Is this still the case? why would you use dnx451 and not dnxcore50 for example?

Also what version of .NET the "dotnet" framework is referring to?

Sul Aga
  • 6,142
  • 5
  • 25
  • 37

1 Answers1

2

Visual Studio cross-compile all your code against all listed frameworks in frameworks section. So:

dnx451, dnx46 and so. This is a full .NET framework and during startup DNX will bootstrap installed version of .NET Framework 4.5.1 or 4.6 or so.

dnxcore50 is new .NET Core that uses CoreCLR runtime and CoreFX Libraries - microsoft's open source project that is subset of .NET Framework designed to be portable and cross platform. You may get rid of it if you do not compile against it and do not care for cross platform development or other benefits .NET Core gives. On the other hand you have to get rid of it if .NET Core does not provide functionality you need like WCF (server side), WPF, reflection API (there is only a subset), application domains. Accessing data from sql server is possible via ADO.NET SqlClient or Entity Framework 7

dotnet honestly I do not know what it is - current documentation does not mention existence of such framework or does it provides any list of valid strings that can be used here. Visual Studio tooling seems to be very liberal in parsing framework (eg.'451' == 'net451'). It compiles for .NET 4.0 at least for me... ilspy

Scott Allen has a blog post on how he would choose dnx flavour. There is also documentation page here on how to choose right .NET (very sketchy in my opinion).

You may be interested in looking at corefx sources to check if .NET Core provides package you need.

pg0xC
  • 1,226
  • 10
  • 20
  • I found this: https://oren.codes/2015/06/09/pcls-net-core-dnx-and-uwp/ where Oren Novotny explains different flavors you may use in `frameworks`. Very informative but does not explain how to choose. And may be outdated already (article written in June) – pg0xC Oct 15 '15 at 20:44