What is a Portable Class Library?

.NetPortable Class-Library

.Net Problem Overview


On MSDN I noticed a section about a Portable Class Library, under Version Information.

See System.Object for an example. http://msdn.microsoft.com/en-us/library/system.object.aspx

I did a brief Google search and couldn't find anything about the Portable Class Library. Does anyone here know what it is or where I could find more information about it?

.Net Solutions


Solution 1 - .Net

UPDATE Oct 9 2017: Article comparing/constrasting .NET Core/Std/PCL UPDATE Nov 23 2016: Article by Rick Strahl

UPDATE Oct 29 2016: .NETStandard 1->2 FAQ UPDATE Oct 19 2016: This is the best interview/video I've seen to date covering .NET Standard 2.0

UPDATE Sep 27 2016: .NET Standard 2.0 announcement post has more good info

UPDATE Jun 6 2016: This article explains well how the .NETStandard library mechanism supersedes much of PCL

UPDATE Jul 10 2013: Excellent state of the PCL union summary blogpost from @shanselman with lots of concrete examples, screenshots and links. Puts any other answer here in the shade.

UPDATE May 20 2013:

UPDATE Apr 19 2013: Excellent dense summary of how it all hangs together from Intellisense through to run time in a blog post by Simon Cooper


Video: Channel 9 Visual Studio Toolbox show episode 14 June 2012

Video: Channel 9 Going Deep Show episode 27 Sep 2011


UPDATE Sep 11 2012: Good high level blog post with pictures, diagrams and motivating examples showing how MVVM Light and RX use it

UPDATE Apr 11 2012: Very good end to end piece by Scott Hanselman that gets to the point in dev speak very quickly including screenshots here (also contains very insightful 'how to think of it' information and links to samples). Also includes a resources section at the end that pretty much duplicates this entire post :D

UPDATE Jul 9 2012: This blog series by Mircea Trofin of the dev team (one part so far) is the most complete coverage yet, including screenshots and detailed matrices showing available features across your selections if you're into that sort of thing.


See Portable Library Tools anouncement blog post, which starts:- > 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.

It's used for creating a Class Library that targets multiple platforms (esp Silverlight variants such as WP7 and SL4, but including XNA on Xbox) at one time.

See also this InfoQ summary article

See also this release notice.

For down and dirty details, see Multi-Targeting Guidelines for Tools for Managed Code

Solution 2 - .Net

>- The Portable Class Library project enables you to write and build managed assemblies that work on more than one .NET Framework platform. You can create classes that contain code you wish to share across many projects, such as shared business logic, and then reference those classes from different types of projects.

>- Portable Library Tools is a new Visual Studio add-in from Microsoft that enables you to create C# and Visual Basic libraries that run on a variety of .NET-based platforms without recompilation.

MSDN now has a nice article/documentation on it. You can check it out and see what is supported in Portable Class Library Icon For Portable Class Library.


>The following assemblies are available within a Portable Class Library project:

>- mscorlib.dll

  • System.dll
  • System.Core.dll
  • System.Xml.dll
  • System.ComponentModel.Composition.dll
  • System.Net.dll
  • System.Runtime.Serialization.dll
  • System.ServiceModel.dll
  • System.Xml.Serialization.dll
  • System.Windows.dll (from Silverlight)

>You can find which members are supported by the Portable Class Library project in the reference topics for the .NET Framework Class Library. In the members table for a class, the following Portable Class Library icon appears next to supported members.

Icon for Portable Class library (Icon for the Portable Class Library which you will see in MSDN Docs.)


To create a Portable Class Library Project you need to have :

> 1. Visual Studio 2010 Service Pack 1 (SP1) (795KB Installer, 1.48GB ISO)

> 2. Portable Library Tools CTP (1.38MB)

After Installing Above updates you will get a new Project Template for Portable Class Library :

enter image description here

(Above Contents taken from MSDN)

UPDATE 2014:

Class Library Portable is part of Visual Studio 2014.

Solution 3 - .Net

It's a class library that can run on various platforms.

Solution 4 - .Net

I found Documents a bit hard to understand so i tried to make things a little clear here.

Portable Class library is built to let programmers create projects that will run over multiple platforms like Xbox 360, Windows Phone, Silverlight and .NET Framework (4 and above). this is done through omitting some specific API's that is not supported by your chosen target platforms that will cause you to lose some available features of .Net Framework.

So we can say, choosing between Portable class library and Normal class library depends on target platforms of your project. if you want your app to work on Xbox and Desktop Computers with windows operating system, you better save your time and use PCL, other than that Normal class library will do fine.

for more information visit documentation page.

Now there is a new and open source technology called .Net Standard which will displace PCL. .NET Standard solves the code sharing problem for .NET developers across all platforms by bringing all the APIs that you expect and love across the environments that you need: desktop applications, mobile apps & games, and cloud services:

  • .NET Standard is a set of APIs that all .NET platforms have to implement. This unifies the .NET platforms and prevents future fragmentation.
  • .NET Standard 2.0 will be implemented by .NET Framework, .NET Core, and Xamarin. For .NET Core, this will add many of the existing APIs that have been requested.
  • .NET Standard 2.0 includes a compatibility shim for .NET Framework binaries, significantly increasing the set of libraries that you can reference from your .NET Standard libraries.
  • .NET Standard will replace Portable Class Libraries (PCLs) as the tooling story for building multi-platform .NET libraries.

You can see the .NET Standard API definition in the dotnet/standard repo on GitHub.

Reference

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmjcoppleView Question on Stackoverflow
Solution 1 - .NetRuben BartelinkView Answer on Stackoverflow
Solution 2 - .NetShekhar_ProView Answer on Stackoverflow
Solution 3 - .NetDarin DimitrovView Answer on Stackoverflow
Solution 4 - .NetAmiNadimiView Answer on Stackoverflow