Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Portable Class Library vs. library project

I want to know the difference between PCL (Portable Class Library) and a normal library.

PCL uses profiles with which it can be determined which platforms and features are available. Both can generate a DLL which can be used on different platforms. For a normal library project you can also set the target framework (e.g. .NET 3.5). Xamarin says that #if compiler directives are only suitable for Shared Projects, which means they are not used in PCL. I think the PCL and the library project are very similar.

So what are the differences, when dealing with different mobile platforms?

like image 236
testing Avatar asked Feb 26 '15 15:02

testing


People also ask

What is the difference between the portable class library and shared projects?

The difference between a shared project and a class library is that the latter is compiled and the unit of reuse is the assembly. Whereas with the former, the unit of reuse is the source code, and the shared code is incorporated into each assembly that references the shared project.

What is portable class library?

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.

What is a PCL project?

Point Cloud Library | The Point Cloud Library (PCL) is a standalone, large scale, open project for 2D/3D image and point cloud processing. The Point Cloud Library (PCL) is a standalone, large scale, open project for 2D/3D image and point cloud processing.


1 Answers

Portable class libraries are platform independent. They do not use conditional compilation and unmanaged code, they have no UI inside (UI is platform dependent). This is because PCL should work on all specified platforms which was chosen as a target. Also, availability of features depends on selected targets.

So a PCL can be referenced by any project which target is specified in the PCL settings. But libraries of other types can be referenced only by projects which have the same target or by upper subsets of .Net (for example, Silverlight libraries can be used in Windows projects but not vice versa).

More about restrictions and features of PCL can be found on two links bellow:

  1. Share functionality using Portable Class Libraries
  2. Cross-Platform Development with the Portable Class Library

On the first link you can read about what is PCL in general. And on second - info about targets and features.

Hope this helps.

EDIT: See also What is a Portable Class Library?

like image 140
Yoh Deadfall Avatar answered Oct 11 '22 16:10

Yoh Deadfall