Question

With the introduction of the Portable Class Library, developers can release a single library which is compatible across multiple platforms. The down-side to this is that the PCL must reduce itself to the lowest common set of classes which are compatible across ALL the specified platforms.

If you want to play to the strengths and functionality of specific platforms, (or if you want access to classes which only exist in certain platforms), I assume you have to do one of the following:

  1. Release a "base" set of classes as a Portable Class Library, with accompanying Platform-Specific libraries which build on it.
    • One example could be an MVVM library: release common base classes as a single Portable Class Library - named "MyCustomMvvm.dll" - and release some additional platform functionality in the form of "MyCustomMvvm.Extras.WPF.dll" and "MyCustomMvvm.Extras.WP7.dll," etc... OR:
  2. Keep a separate project for each platform, using "linked" source files and #if statements to conditionally compile platform-specific functionality.
    • For this example all the libraries would have the same filename ("MyCustomMvvm.dll"), but would have a separate copy for each platform, built using a platform-specific project within your solution.

My question is: are those the only two options? Is there a clearly "better" option?

Was it helpful?

Solution

check out http://blogs.msdn.com/b/rxteam/archive/2012/03/12/reactive-extensions-v2-0-beta-available-now.aspx specifcally the section "Towards a Portable Library world". Rx targets a lot of different runtimes so it's a good example use case. They have generally done what you suggest as option 1 and use NuGet to manage a lot of the distribution.

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

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

i'm not sure if there are reliable or useful alternatives.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top