Search code examples
xamarin.iosxamarin.androidxamarinsystem.reactiveportable-class-library

Rx 2.1 & Xamarin


I'm trying to build an app on Xamarin that targets multiple platforms but uses rx. So far I've created a core PCL which I would like to use rx, but when I tried to import the rx 2.1 nuget package I get the following error:

You are trying to install this package into a project that targets 'portable-net40+win+sl50+wp80+MonoAndroid10+MonoTouch10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I am aware that there is an rx component in the xamarin store, but it doesn't seem like I can add this into my PCL.

It seems to me that ideally I want the core rx libraries in the PCL, but that platform specific schedulers should be imported in the platform specific app implementations.

What is the best way to proceed at the moment?

n.b. I am aware this has been touched upon in other questions, but the answers pre-date release channel PCL support in Xamarin.

edit:

I've modified my PCL to target .net 4.5 (and removed silverlight). I can now pull in the rx nuget package but I'm getting a build warning that it cannot resolve 'system.runtime.interopservices.windowsruntime'.


Solution

  • At the moment, Xamarin Stable can't build PCLs (Alpha just got it, I haven't experimented with it though). Just use multiple csproj files at the moment (see https://github.com/paulcbetts/starter-mobile for an example)