Reputation: 417
We're building an app using Xamarin Forms for iOS, and our team has built a portal library that was intended to be re-usable in other projects. We've determined we want to build a UWP project, and are trying to re-use their code in the Portable projects.
Their code references sqlite-net, which from my understanding has a "bait" pcl with no implementation, and then has a second "switch" assembly that provides the implementation based on the environment. And when I try to run a sqlite command from this library in my UWP project, I get the follow error message:
Something went wrong in the build configuration. This is the bait assembly, which is for referencing by portable libraries, and should never end up part of the app. Reference the appropriate platform assembly instead.
So if I'm not mistaken this either means 1) I'm expected to implement the wrapper myself somewhere in my project, or 2) the sqlite-net project is supposed to implement this wrapper, but hasn't done so for UWP yet. Or 3) Something else and I'm grossly misunderstanding this entire thing.
I read about referencing the SQLite for UWP, but that extension is only available on UWP, whereas the library with the sqlite code is labeled Portable and has no access to UWP extensions.
If it matters, this is the sqlite-net github that we've installed
https://github.com/praeclarum/sqlite-net
And if it ends up being the case that this is incompatible with a UWP project, are there any alternatives out there that would work with both of our environments?
Upvotes: 2
Views: 474
Reputation: 3568
The nasty little trick with bait+switch is, that the platform specific project (so to say, the top level) has to include the switches. Not just the PCL, that is actually using them.
That's what makes it load the platform specific assembly in the package.
So just add the sqlite-net raw package to your UWP project too and it should run fine.
Upvotes: 2