Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Dia 4.1 shared asset projects and portable class library (pcl) projects

1,139 views

Published on

Sharing code between platforms: shared asset projects and portable class library (pcl) projects

Published in: Software
  • Be the first to comment

  • Be the first to like this

Dia 4.1 shared asset projects and portable class library (pcl) projects

  1. 1. Xamarin Shared Asset Projects vs Portable Class Library
  2. 2. Xamarin Shared Asset Projects Use a single set of files and offers a quick and simple way in which to share code within a solution and generally employs conditional compilation directives to specify code paths for various platforms that will use it
  3. 3. Xamarin Shared Asset Projects Benefits : ● Allows you to share code across multiple projects. ● Shared code can be branched based on the platform using compiler directives (eg. using #if __ANDROID__ , _IOS__ , __WINDOWS_PHONE__) ● Application projects can include platform-specific references that the shared code can utilize (such as using Community.CsharpSqlite.WP7 in the Tasky sample for Windows Phone).
  4. 4. Xamarin Shared Asset Projects Disadvantages: ● Unlike most other project types, a Shared Project has no 'output' assembly. During compilation, the files are treated as part of the referencing project and compiled into that DLL. If you wish to share your code as a DLL then Portable Class Libraries are a better solution. ● Refactorings that affect code inside 'inactive' compiler directives will not update the code.
  5. 5. Xamarin Shared Asset Projects
  6. 6. Shared Asset Projects
  7. 7. Xamarin Portable Class Libraries Projects target specific profiles that support a known set of BCL classes/features. However, the down side to PCL is that they often require extra architectural effort to separate profile specific code into their own libraries
  8. 8. Xamarin Portable Class Libraries Benefits: ● Allows you to share code across multiple projects. ● Refactoring operations always update all affected references.
  9. 9. Xamarin Portable Class Libraries Disadvantages: ● Cannot use compiler directives. ● Only a subset of the .NET framework is available to use, determined by the profile selected.
  10. 10. Xamarin Portable Class Libraries
  11. 11. Xamarin Veamos un pequeño ejemplo!
  12. 12. Xamarin Muchas Gracias

×