Curent status
I have got the following setup (simplified example):
MySolution
┠ MyPclLibrary (PCL targeting .NET Standard 1.3)
┃ ┗ Referencing Microsoft.EntityFrameworkCore.Sqlite (NuGet package)
┕ MyAndroidApp (Xamarin Android)
┗ Referencing MyPclLibrary
In other words MyAndroidApp
references MyPclLibrary
which in turn references Microsoft.EntityFrameworkCore.Sqlite
installed as a NuGet package. I work with Visual Studio 2015 Update 3 on a Window 7 SP1 machine.
The problem
Now the problem is that when I try to build the solution I get the following error message:
Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.EntityFrameworkCore.Sqlite, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Perhaps it doesn't exist in the Mono for Android profile?
I have already checked the MyAndroidApp\bin\Debug
directory and I can see that the Sqlite DLL has NOT been copied to the output directory.
Of course, MyAndroidApp
does NOT make direct calls to Microsoft.EntityFrameworkCore.Sqlite
. Instead, MyPclLibrary
is responsible for communication with Sqlite.
My best guess it that this problem is somehow related to the new dependency management based on project.json
(MyPclLibrary
uses project.json
while MyAndroidApp
uses packages.config
).
What have I already tried?
- Direct reference (works but is not acceptable): An easy fix would be to add reference to
Microsoft.EntityFrameworkCore.Sqlite
directly fromMyAndroidApp
- so make the library a first class reference. However this completely defies the solution architecture and therefore is not acceptable. - Dummy class: I thought the problem might be that there is no obvious usage of the Sqlite (as it is basically a set of extension methods). Therefore I created a dummy class with a single method which enforces a call to the Sqlite so the Sqlite may not be optimized out - to no avail.
- No Linker in Adnroid Options: I have set the
Project Properties (of MyAndroidApp) -> Android Options -> Linker -> Linking
toNone
as Android Linker may ignore some assemblies that are used solely dynamically - again, to no avail.
Question
How can I use a secondary reference within a Xamarin Android project? I might have missed something really stupid so I am open to any suggestions.