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

12
Xamarin Shared Asset Projects vs Portable Class Library

Upload: hernan-zaldivar

Post on 09-Jan-2017

140 views

Category:

Software


0 download

TRANSCRIPT

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

XamarinShared Asset Projects

vsPortable Class Library

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

XamarinShared Asset ProjectsUse 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

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

XamarinShared Asset ProjectsBenefits : ● 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).

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

XamarinShared Asset ProjectsDisadvantages:● 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.

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

XamarinShared Asset Projects

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

Shared Asset Projects

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

XamarinPortable Class LibrariesProjects 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

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

XamarinPortable Class LibrariesBenefits:● Allows you to share code across multiple

projects.● Refactoring operations always update all

affected references.

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

XamarinPortable Class LibrariesDisadvantages:● Cannot use compiler directives.● Only a subset of the .NET framework is

available to use, determined by the profile selected.

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

XamarinPortable Class Libraries

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

XamarinVeamos un pequeño ejemplo!

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

XamarinMuchas Gracias