3

In the new project wizard in Visual Studio 2017, I see both the option to create a new .NET Standard library as well as a new .NET Core library. I understand that .NET Standard is a specification while .NET Core is a cross-platform implementation of that spec.

But can someone explain the real differences when creating libraries from each of the following ways? To make matters worse, if you look closely, both dialogs also have a drop-down on the top that says ".NET Framework 4.6.2" :( - what's up with that?

.NET Standard Library

Standard

.NET Core Library

Core

Side note: The naming convention is confusing. ".NET 5" sounds simpler

4
  • The naming convention is because starting with 4 they started to use Semantic Versioning, They won't change to .NET 5 till they make a change to the framework that would cause it to be not backward compatible with stuff developed with 4.x. That is the point of the numbering system, if you are running on a version of 4.x that is greater or equal to the version you wrote your code for you know your code will compile without any changes required at all. If you try to compile your code on 5.x you know you need to check for compatability. Commented Mar 14, 2017 at 18:58
  • But they discarded that thought when calling it .net core 2.0 :( blogs.msdn.microsoft.com/dotnet/2016/09/26/… Commented Mar 14, 2017 at 19:00
  • We are talking about the .NET framework not the .net core versioning. Commented Mar 14, 2017 at 19:03
  • Remember the PCL library project templates? The previous solution to creating cross-platform libraries. That's retired for .NETCore, suffering too much from the n! problem, replaced by .NETStandard. The compatibility grid is here. Do keep in mind that this is work in progress, 2.0 will take a while to show up. Commented Mar 14, 2017 at 19:24

2 Answers 2

3

The upper drop down (".NET Framework 4.6.2") do nothing when you want to create .NET Core or .NET Standard project.

(Maybe related conversation: https://twitter.com/bradwilson/status/836434975985577984)

Sign up to request clarification or add additional context in comments.

1 Comment

It was also a reported bug but the VS team doesn't think it's a bug ("won't fix") developercommunity.visualstudio.com/content/problem/13206/…
3

Using this diagram

enter image description here

If you create a .NET Core library your library can only be used by things in the Blue section and only use things from the Blue section or the Red section. If you create a .NET Standard library your library can be used by things in the Green, Blue, Orange, and Red sections but only use things from the Red section.

The reason you may want to use a Core Library over a standard library is you have potentially access to more functions and libraries to call from your code if you know you are targeting Core only. You don't need to keep the public API's surface area you consume restricted to things that are allowable in all 4 sections.

2 Comments

So a standard library (red) is not necessarily cross-platform?
If you build a DLL targeting netstandard1.0 for the <FrameworkTarget> in the .csproj, that DLL can be used on any platform that supports 1.0 or newer. If you build a DLL targeting netcoreapp1.0 you will only be able to use it in projects also targeting netcoreapp1.0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.