Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The reason why Portable Class Libraries were created (in architectural meaning)?

There are pretty many articles about what are PCL like this.

However, from all what I found, they just mostly say something like:

The Portable Library Tools CTP adds a new "Portable Class Library" project template to Visual Studio that can be used to create class libraries in C# and VB that run on the various .NET platforms without recompiling.

But carefully read this superb explanation of how .NET (and Mono) works, I became even more unclear why PCLs even needed.

Because if I've built some Assembly and it contains CIL bytecode (which can be used through any other platform (if corresponding platform has CLR implementation (as the main idea of .NET was))), then what's the problem? Why we would then also need the PCLs?

like image 812
CodeIt Avatar asked Nov 13 '13 23:11

CodeIt


1 Answers

Although the IL may be the same, the available libraries are not. If you want to target a desktop computer, a Windows 8 app, and Silverlight, you want to ensure that your code uses things that are actually present in all of those places.

Portable Class Libraries ensure that you only use that set of libraries that are applicable to your selected platforms.

You may want to read more details on this .Net Framework blog from a year or so ago.

like image 88
Chris Hannon Avatar answered Nov 15 '22 08:11

Chris Hannon