Question

I am maintaining a portable class library that target major .NET and Mono platforms. The core PCL uses profile 147 (.NET 4.03 + Windows Store + Silverlight 5 + Windows Phone 8), however due to some technical reasons the NuGet package consists of three versions: core PCL (profile 147), .NET 4 and Silverlight 5. Practically I could change the profile of the core PCL and replace .NET 4.03 with .NET 4.5 and drop Silverlight 5. I don't do this in case my lib will be consumed from other PCL - for this reason I would like to use the widest PCL.

So my first question is whether this assumption is correct. E.g. even though I have separate SL5 implementation, choosing a PCL profile with SL5 support makes it more PCL-friendly, e.g. another PCL targeting SL5 would be able to reference my lib.

If this assumption is correct, my next question is whether this is worth it. Now that there are popular PCL profile choices for Xamarin development, none of them targets .NET 4. And the one that is recommended is profile 78 that doesn't target Silverlight. I haven't found a detailed description of consequences of not choosing these profiles, so I can't figure out what I am losing by staying with profile 147. If there are known problems and not supported functionality, I will of course swicth to a more modern profile, but as I wrote earlier I'd like to target wider platform set if possible.

Was it helpful?

Solution

It's a tradeoff between breadth and features. If targeting a profile with Silverlight supports all the APIs that you want or need, then stick with it. You have no choice to make, go for breadth. Excluding test cost, there's no point limiting yourself or your consumers.

However, when choosing a profile with Silverlight or another platform prevents you from using a particular feature (and that feature hasn't been provided out-of-band, such as via Microsoft BCL Portability Pack) this is where you need to make the hard decision. The support feature table on this page Cross-Platform Development with the Portable Class Library can help you with this decision by showing what features you lose/get by targeting certain platforms.

Looking at the data internally, I can see that "Profile78" (.NET Framework 4.5, Windows 8, Phone 8, Xamarin.Android, Xamarin.iOS) is overwhelming the most popular target (~45% of portable projects target this). This is not surprising. It targets large breadth of modern platforms with a reasonable large feature support. These platforms that this profile targets, also support what we consider our "modern surface area", hence have way more shared API surface vs profiles that target platforms that support our legacy surface area (Silverlight, .NET Framework 4). The difference between these two surface areas are covered in detail here: What is .NET Portable Subset (Legacy)?.

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