Choosing between the full .NET framework and .NET Core as target ASP.NET Core?

I am extending a system using .NET 4.5. I need:

  • Other projects to be able to reference my new .NET Core libraries.
  • My .NET Core projects to be able to reference our .NET 4 libraries.

Aside from asking which one is targeting, I also noticed that VS 2017 doesn't even give me the option to target .NET Core when creating a new project. enter image description here

+3


source to share


1 answer


.net Core libraries are standard .net libraries. Therefore, when you create the .net standard library, the complete framework classes can reference it, but only if the version of the .net standard you are using is correct. Sound confusing?

In simpler terms, take a look at this graph here https://github.com/dotnet/standard/blob/master/docs/versions.md

enter image description here

If your full framework classes target the .NET Framework 4.5, then in order to use them in .net core 1.0 as well, you need to force your libraries to use the .net 1.1 standard.

If you already have a fully functional web application and want to create libraries in the .net standard. The only reason you should be doing this is ...



  • In the near future, you intend to transform your WebApp into a .net core.
  • You are creating a class library that can be used in other mainstream .net projects.

If you stick to the full framework for your web application for the foreseeable, there really isn't a need to build things in the .net standard (especially if you need to shoot for a very stripped down version of the standard like 1.1).

As for why you can't "target" the framework when creating the main .net project. This is a known "bug" if you will. Or even more so to make the dropdown redundant when you create the main .net project. It just uses the latest SDK.net core on your computer (by default).

Further reading:

+5


source







All Articles