Shared Project vs PCL (Portable Class Libraries)

Tim Buchalka's Learn Programming Academy
A free video tutorial from Tim Buchalka's Learn Programming Academy
Professional Programmers and Teachers - 990K+ students
4.5 instructor rating • 50 courses • 990,324 students

Lecture description

In this lecture you will learn about the main difference between sharing code with Shared projects and doing so with PCL, as well as the benefits and disadvantages of each

Learn more from the full course

The Complete Xamarin Developer Course: iOS And Android!

Build Cross Platform Android and iOS apps with Xamarin Forms, Xamarin Classic, Azure Mobile App Services, Rest and more

29:18:29 of on-demand video • Updated August 2020

  • Create native Android and iOS apps that share up to 100% code
  • Apply for junior mobile development positions (Android and iOS)
  • Increased career options as a Multiplatform developer
  • Learning Xamarin opens up opportunities to build Windows Desktop, Windows Store, Mac, and even smart watch apps that share the logic of your iOS and Android app
English [Auto] By now you already have your Mac or your windows ready to start developing Android and iOS applications just in summary. And we're going to start by creating a new sewing project in the next lecture hall before moving forward to that. I want to touch a bit more about the differences between shur projects and Bisi else these are the two ways that you will be able to share code between projects in the next lecture when we create our first project. You'll notice that you have both options when you create something pratique from a template. So I wanted to talk about the differences the benefits and disadvantages of each of these options. Let's is start by just stating that both of this will allow you to share code between platforms between android us and even Windows if you were disappointed. Do the rest of the curse. You'll actually get to use both of this so you can compare them by yourself and choose whatever suits you the best. Let's start with the basics. Side by side the differences between the ship product and the PCL which stands for portable class library. Is that the ship project will include all the research says inside it into each project. Well to put a world class library will generate an assembly a portable assembly which will be ideal M-file that is later referenced into each of the projects. So this is the main difference in the case of the ship project. All of the resources will eventually make it as it is into each of the projects. Well in the PCL all of the resources will be compiled into a portable assembly and that portable assembly that the L file is the one that is to be shared into each project. So I mentioned that this is going to be sold on some benefits and some disadvantages for the platforms the benefits of the share project is that you can actually have branched code. This means that inside of the very shared project you can have some code that is specific for Android and some code that is specific for virus for the same reason you can have blood for specific references to be added in case of the PCL. The benefits is that you kept refractory that always updates all the references and the PCL is always a better solution when you plan to share the resoled assembly than the old health file with other developers when it comes to disadvantages. The ship project because it has no output like the PCL doors it is not ideal for sharing with other developers because you will have to share the entire project. There is no one else file or no one file that you can share from other developers to implement and the refactoring will not always update all of the resources. And this is because like we said there is some platform specific code that can be added. So for example when you are refactoring the active code easy Iowas code then the Android code won't be updated. And the same way if you are refactoring when the active code is the android code then the iOS code won't be updated. And the disadvantages of the PCL is that you cannot have a block from a specific code from a specific references like you do on the ship project and only a subset of the dot net framework is going to be available. This is because when you create the PCL you actually have to select what project it's going to support. So for example when you select that you have to support something I guess. So all other dot net framework capabilities mean to be available for some in the US. So the entire PCL won't support those features. Haven't talked about this. It is of course going to be more off use once we start developing our applications. You will be more obvious for you to identify the differences between one and the other but mainly both of them will want to share code between platforms and both of them will allow you for very high optimization of code reuse in the next lecture. We will start by creating a product that uses a shirt product to share code between platforms. Because currently the something like player only supports the share project we're really I do always recommend to use the PCL because sharing the output of that BCO is just so important for teams and for leader sharing something that has already been implemented before something that is project won't easily allow to do.