I've heard of
All of these were explained to me as "a subset of the full .Net that allows you to target multiple platforms". So my questions are
(My specific situation: I have a library that targets .Net 2.0, .Net 4.5, and UWP. Targeting UWP required creating a new VS project and linking all the existing files, which is a huge pain. Now someone is telling me it doesn't work for PCL, and from the sound of it I have to do it AGAIN for .Net Standard!?)
I'll answer your second question first:
I have a library that targets .Net 2.0, .Net 4.5, and UWP. Targeting UWP required creating a new VS project and linking all the existing files, which is a huge pain. Now someone is telling me it doesn't work for PCL, and from the sound of it I have to do it AGAIN for .Net Standard!?)
If I want to write a library that's usable to as large an audience as possible, which one (or more than one) of these do I need to use?
Short answer: you should target netstandard
. Use the lowest version that has all the APIs you need. You can use a tool like API Port to check your existing project for compatibility with a given netstandard
version.
Unfortunately, this approach will leave behind older platforms, in your case, .NET 2.0. If maintaining .NET 2.0 support is necessary, then you'll need a separate project (with linked files) to build a separate .NET 2.0 assembly.
On to the details...
What's the difference!?
netstandard
) - this is the new cross-platform BCL API. It's a "standard" in the sense that it's just an API definition and not an implementation. The idea is that you can compile your library to (a version of) this API and it will run on any platform that supports that version.netstandard
(with a few extra bits). It is a cross-platform implementation of that API. It is possible that UIs and other frameworks may build on it, but for now its only sure foothold is acting as the platform of choice for ASP.NET Core. [Side note: for historical reasons, ".NET Core" is completely different than the netcore
NuGet target; when you're in a NuGet context, netcore
means "Windows 8/8.1/10"].netstandard
.netstandard
version; as such, it is much more difficult to support than any other platform. However, it is still used on devices with tight memory constraints.netstandard
.