Project PCL and nuGet

BenjaminDowdenBenjaminDowden USMember, University, Developer Group Leader

We are trying to migrate our iOS/Android app to use Xamarin.Forms. Our current solution has linked files to a iOS and Android specific class library which the main iOS and Android UI project references. The class library contains a reference to sqlite-net, which we had to wrap in a custom project in order to get it to compile into iOS and Android.

We want to move away from linked files and utilize a single PCL project. We created the PCL project (profile 78) and added a reference to sqlite-net via nuget. When we go to compile we get an error "Thread does not exist in the current context" - obviously Profile 78 doesn't contain System.Threading.Thread.

Is it not possible to have a PCL data access library for Android and iOS that uses sqlite-net?

Posts

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    It is possible, you just might need to include the Microsoft BCL Portability Pack from Nuget as well.

  • BenjaminDowdenBenjaminDowden USMember, University, Developer Group Leader

    Hrm. Nope, that didn't work either. When I try to add the BCL Portability Pack from nuget I get an error saying it can't be added to a project targeting Profile 78.

    Just to be clear - I have a PCL that targets Profile 78 and I added the sqlite-net package to that project. When I did that I got two files added to the project - SQLite.cs and SQLiteAsync.cs. All my compilation errors are in SQLite.cs.

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    Make sure you are installing the "SQLite.Net PCL" nuget package. It should work just fine for PCL Profile 78(Standard One)

    image

  • TomFischerTomFischer AUMember
    edited May 2014

    Thank you Jon, I spent hours trying to understand why the default nuget package "sqlite-net" was compiling fine separately in a Android project and in an iOS project but not in a PCL. Now that i'm using SQLite.Net PCL it seems better...

  • BenjaminDowdenBenjaminDowden USMember, University, Developer Group Leader

    Ah. I was trying to add through Xamarin Studio in OSX; once I used VS 2013 it worked fine. My Xamarin studio might be a little messed up after I tried getting PCL's to work a few months back.

    Thanks for your help!

Sign In or Register to comment.