Search code examples
.netsilverlightwindows-phone-8portable-class-library

Cannot use ICommand in Portable Class Libary für .NET 4.5, W8, WP8.1 and SL5


I want to create a PCL for .NET 4.5, Windows 8, Windows Phone 8.1 and Silverlight 5, however I am not able to use ICommand when checking all of these platforms, although all of them should support it according to MSDN.

Steps to reproduce:

  • Create a PCL project with .NET 4.5, Windows 8, and Silverlight 5
  • Create a class that implements ICommand and generate the members
  • Build succeeds

  • Add Windows Phone 8.1 in the project settings

  • Build fails (cannot find System.Windows)
  • If you remove either Silverlight or WP it works, but with both active at the same time it doesn't.

Is this is bug? Or am I missing something?


Solution

  • Unfortunately we weren’t able to support ICommand (and other ViewModel types such as ObservableCollection) in PCLs that target both Silverlight 5 and Windows Phone 8.1. I’d suggest dropping SL5 support from the PCL and supporting that platform via a non-portable library.