Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any difference/reason to create dnx50 build target in addition to dnx451?

Usually we see the following targets in project.json:

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

dnxcore50 will be the only portable version of the project code and dnx451 actually targets .Net 4.5.1 mscorlib etc...

Now, if I add another target called dnx50, this will create a valid output and works just fine.

The difference between dnx451 and dnx50 is, that it references different .Net assembly dlls

For example mscorlib.dll:

  • dnx451 references C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll
  • dnx50 references C:\Windows\Microsoft.NET\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll which essentially is the .net 4.6 version.

Question now is:

Does it make sense to create that dnx50 target for your custom library for example? Basically to target .net 4.6 and you need certain functionality the dnxcore50 portable doesn't have?

Or is the dnx451 target actually enough, and if I don't need a specific feature from the more recent .net versions (4.5.2, 4.6), this target would use .net 4.6 anyways if it is installed on the system and I'm just targeting the lowest version necessary for my project?

Does that mean that having both, a dnx451 and dnx50 target, would actually create the same output, right?

like image 832
MichaC Avatar asked Jun 02 '15 15:06

MichaC


1 Answers

See this question for full details. Here is a list of all the different types you can use:

  • dnxcore50 - DNX SDK running on CoreCLR/CoreFx
  • dnx451 - DNX SDK running on .Net 4.5.1 (Desktop CLR / Full BCL and FCL)
  • net46 - .Net Framework SDK running on .Net 4.6 (Desktop CLR / Full BCL and FCL).
  • uap10.0 - UWP SDK running on .Net Native/CoreFx
  • dotnet - any pure IL code which declares its dependencies (instead of a PCL contract). Framework dependencies are available for .Net 4.6, DNX or UWP.

For .NET 4.5 you need to use dnx45 for ASP.NET projects and net45 for other projects to target .NET 4.5. Which one you target depends on what you want to do, you can even target more than one at a time.

Currently the .NET Core (DNX) has very limited functionality. If this does not give you enough, then target the full .NET runtime dnx46 for ASP.NET 5 using .NET 4.6 and net46 for other projects using .NET 4.6.

like image 163
Muhammad Rehan Saeed Avatar answered Oct 10 '22 23:10

Muhammad Rehan Saeed