What is a Portable Class Library?
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:
- Very practical coverage of practical application and implications of this for cross-device stuff (think Xamarin Studio) in Tablet Show podcast with Atley Hunter. Key takeaway:- PCLs are a very useful constraint to impose on onself in cross-device scenarios.
- One of the libraries mentioned wrt that is the excellent MvvmCross which is discussed in a separate Tablet Show Episode 71 with it's author @Stuart Lodge. Only minor tweaking as described by Stuart here to environment setup is necessary to leverage PCLs for such purposes.
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
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
.
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 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 :
(Above Contents taken from MSDN)
UPDATE 2014:
Class Library Portable is part of Visual Studio 2014.
It's a class library that can run on various platforms.