Reputation: 34499
I was writing up the supported platforms for my PCL recently, one of which is other PCLs. I was confused if my library (which targets .NET Framework 4.5 and Windows/Phone 8.1) can be used in .NET Core projects as well.
As I understand it, PCLs allow you to share code across multiple platforms without recompilation, while .NET Core does that as well. The only difference is that .NET Core targets a few more platforms, i.e. OS X and Linux, and is open source.
So essentially, I don't see how .NET Core is any different than Microsoft rebranding the PCL and saying "PAY ATTENTION we're going open source and targeting non-Windows platforms!"
So the bottom line is, are PCLs compatible with .NET Core, and vice versa? What's the difference between them?
Upvotes: 16
Views: 5462
Reputation: 5240
There is a beautiful article series about it which solved my questions around it ...
https://oren.codes/2015/06/16/demystifying-pcls-net-core-dnx-and-uwp-redux/ https://oren.codes/2015/07/29/targeting-net-core/
.Net Core has all his libraries (e.g. System.IO) in separate NuGet packages (each of them available for the SDKs DNX, UWP and .Net 4.6). Third party libraries target dnxcore50
(DNX) or uap10.0
(UWP) if they access the platform natively or rely on their features. If they do not access the platform but only rely on other packages, they should target dotnet
.
dotnet
effectively means: I am compatible with any platform which satisfy my dependencies (your library XYZ "dotnet" which uses System.Reflection dnxcore5+net45
could not be used by a UWP uap10.0
app). This effectively ends the combinatoric nightmare of the platforms. The previous target combination dnxcore5+net45
created an intersection between the platforms libraries and each addition would make the situation even worse. dotnet
on the other side does not restrict the library on a target but instead forwards this restriction decision to its dependencies (where suddenly new restrictions like the famous unicorn
platform can show up).
Therefore as a library author you can target dotnet
if you just need other libraries.
Answering your question:
dotnet
, dnxcore50
or uap10.0
depending on the need of your library (see Owen's article for same basic compatibility with the contract Profile 259).All of that answer is my current understanding of the .Net Core library situation. It is work in progress, and like mentioned in the posts, not yet public documented.
NOTE DEC 2016: Be aware, dotnet
as the predecessor to netstandard1.x
has changed in its concept starting with netstandard2.x
(.NET Core 2.0; ~JUN 2017). Beginning with netstandard2.0
there will be one common contract (the netstandard.dll) which all platforms (.NET Core, .NET Framework, Xamarin, Mono, Unity3D) implement. This contract will be extended over time and the platform have to either drop support for the latest standard, throw NotImplementedException or implement it.
Upvotes: 14
Reputation: 283
My understanding is they both are in concept different.
Upvotes: 0