Portable Class Library vs Platform-Specific Releases

With the introduction of the Portable Class Library, developers can release one library that is compatible across multiple platforms. The downside of this is that PCL should come down to the lowest common set of classes that are compatible across all of these platforms.

If you want to play into the strengths and functionality of certain platforms (or if you want to access classes that exist only on certain platforms), I assume that you must do one of the following:

  • Release the “base” set of classes as a library of portable classes, with the appropriate platform-specific libraries that build on it.
    • One example would be the MVVM library: release common base classes as one portable class library - "MyCustomMvvm.dll" - and release some additional platform functionality in the form of "MyCustomMvvm.Extras.WPF.dll" and "MyCustomMvvm.Extras.WPF. dll ", MyCustomMvvm.Extras.WP7.dll" etc. OR:
  • Keep a separate project for each platform using the “linked” source files and #if statements to conditionally compile the platform’s functionality.
    • In this example, all libraries will have the same file name ("MyCustomMvvm.dll"), but a separate copy will be created for each platform, built using a specific project as part of your solution.

My question is: are these two options? Is there a "better" option?

+4
source share
1 answer

check out http://blogs.msdn.com/b/rxteam/archive/2012/03/12/reactive-extensions-v2-0-beta-available-now.aspx , in particular, in the section "To the world of portable library " Rx is aimed at many different working times, so this is a good use case. They usually do what you offer as option 1, and use NuGet to manage a large number of the distribution.

NuGet 2.1 is making changes to help with this endeavor: http://nuget.codeplex.com/discussions/391121

Your second suggestion is how MVVM light does it for http://blogs.msdn.com/b/dsplaisted/archive/2012/08/27/how-to-make-portable-class-libraries-work-for -you.aspx , except that there is no reason to call all assemblies the same.

I am not sure if there are any reliable or useful alternatives.

+1
source

Source: https://habr.com/ru/post/1436879/


All Articles