The setup is like this:
- A Xamarin.Android application, which depends on Android class library (at least that's what the template is called in VS)
- Said class library, the purpose of which (not entirely relevant, but FYI) is interfacing with a REST service and has a dependance on the famous Newtonsoft.Json NuGet package.
- An NUnit test project for said library.
IDE is Visual Studio 2017, latest version.
If you build and deploy the app on the phone, everything is fine. However, if you try to run tests from the tests project, it says that it can't find the Newtonsoft library.
I've even managed to find a sort of reason: when the library gets built, it's dependancies aren't packed inside, and they are not copied to build directory. When .apk is built for the phone, the dependancies ARE getting packed inside. However, when NUnit project builds itself, it only takes the library, and the dependancies are nowhere to be found. However, there's no interface to control the behaviour of NuGet "Package Reference" type dependencies (blue ones), the properties window is empty for them. And I found no way to add NuGet packages to this kind of project as a ".config" type of dependancy (grey one).
There is a workaround - you can add the Newtonsoft package to the NUnit test project, then it gets copied to the build directory and the Android library works with it, however it doesn't feel right to me. Tests don't need that reference and it has no business in that project.