Couchbase lite .Net Xamarin PCL compatibility

I am developing android, ios and windows phone apps in Visual Studio (Xamarin apps) where I would like to make a reusable data access layer as a portable class library. However, when I try to install the Couchbase Lite .Net nuget package in a portable class library I get the following error:

Could not install package 'Couchbase.Lite.Storage.SystemSQLite 1.3.1'. You are trying to install this package into a project that targets 'portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+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 have heard of the"bait and switch" principle, but not sure exactly how to do that. What is the best way to make a reusable couchbase lite project?

Couchbase Lite is not PCL compatible. I have no plans to make it PCL compatible with .NET Standard on the rise now, and instead I aim to target .NET Standard 2.0 once it is out in Q1/Q2 2017. The problem is that there is a lot of API in Couchbase Lite that is not PCL compatible, and requires a lot of refactoring to make it so. The best way to use it in a PCL project at the moment is to go the shared project route:

  1.   Core project (shared) containing Couchbase logic
    
  2.   Other projects reference the shared library, and pull down the references to Couchbase Lite from Nuget.
    

That being said, Couchbase Lite is also not compatible with Windows Phone because the API is so much different than regular .NET (the same reason there is no PCL support). The first goal from above is to get Couchbase Lite compiling with UWP. After that happens it should be a pretty easy sprint to .NET Standard 2.0 support.

Ok I understand. I will make a shared project. Looking forward to the .NET standard support as well. Cheers.

I have the same need for a Xamarin Forms app for Android, but I decided to write a wrapper generator that will create a set of bait and switch PCL libraries from an assembly, eg Couchbase.lite for Android. It uses ILSpy and Roslyn to read and generate the wrapper source code. There are a number of platform specific parts of the API, but I can specify to avoid those, capturing most of the remaining Api. It also doesn’t work on extension methods, and static classes, eg Log. Problem is that it’s not done, and may take a month or so to get it all working. But, I figure there are other APIs I have to do the same for.