I've been developing several cross platform mobile projects using Xamarin. Pretty much all of them utilize SQLite in some way. I've been maintaining two separate libraries for my SQLite functionality; one for iOS and one for Android. The way I've been doing things has limited how much code I can re-use between my Android and iOS versions of my applications. I would like to consolidate much of my SQLite functionality into a single cross platform library in order to allow further consolidation of code.
The issue that I'm running into is when I try to install SQLiteNetExtensions
. I seem to only be able to install this on an Android or iOS project, but I cannot install it on a PCL iOS/Android project.
This is the error that I get when I try to install SQLiteNetExtensions
in the Package Manager Console:
Install failed. Rolling back...
Install-Package : Could not install package 'SQLite.Net-PCL 3.0.5'. You are trying to install this package into a project that targets 'portable-net45+sl50+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.
At line:1 char:1
+ Install-Package SQLiteNetExtensions
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
The type of project I'm trying this on is a C# Portable Class Library. I select that when I create the project, then I select the target frameworks like so:
Then I right click on References and select Manage NuGet Packages. I enter sqlitenetextensions in the search and I click on Install for SQLite.Net Extensions-PCL. After that I get the error.
This error does NOT occur when I create an Android or iOS library project and attempt the same sqlitenetextension install.
How can I fix this issue?
I believe the issue is that SQLite.NET PCL is not compatible with Silverlight 5, only 4.
There is a fork here you could try: https://www.nuget.org/packages/SQLite.Net-PCL-Silverlight/ It works for me, although I haven't checked against Xamarin.