1

I'm getting an error when trying to run my Xamarin.Forms solution (targeting Android) after adding a new package reference on PCL project.

The error is:

System.IO.FileNotFoundException: Could not load assembly 'SQLiteQueryBuilder, Version=0.0.1.6, Culture=pt, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?

The weird thing is that this library is being referenced and used only on the Portable project, not on the platform project.

If I force to install the same package in the platform project it compiles and runs well.

I've created a new solution with sharing strategy based on .NET Standard 2.0, added the same package reference to it (and not to the platform projects) and the Android app runs fine as well.

I'm very confused about what's going on here, can anyone help me to understand?

Please, let me know if any additional information is required.

Diego Rafael Souza
  • 5,241
  • 3
  • 23
  • 62
  • Xamarin and .NET Core are still in development ... I don't think your question / concern have reason to exist. And AFAK .NET Standard is a kind of shared (common) code, PCL is not, it sound more like .NET Standard 0.0 :) – Fabrice T Apr 02 '18 at 20:31
  • @FabriceLylianTayou Okay, maybe you have a point. But it doesn't seem to make sense write a platform independent code if I have to refers to all my 'platform independent packages' on the platform projects. I know that PCL is an ugly duck that Microsoft is working to burninate from history, but even thus I can't understand how this kind of requirement can be justified. Can you please share some docs reference? I've suspected about it, but couldn't get any official statements about such a thing – Diego Rafael Souza Apr 02 '18 at 20:52
  • 1
    I think this will help you to understand https://stackoverflow.com/a/39091491/3998265 In my opinion, to make things simpler, we can say that PCL is discovering references in every platforms, a specific version of the dll is created according to the targeted platform but .NET Standard load and embed that references and is the same for every platform Regarding your project SQLite refer to IO which may work differently between PCL and .NET Standard – Fabrice T Apr 02 '18 at 21:05
  • IO is an example, the `Not found` error you get could be child of another issue. And the packages are managed in a different way between PCL and .NET Standard. Personally I recommend you to stop looking for an answer – Fabrice T Apr 02 '18 at 21:10
  • 1
    @FabriceLylianTayou Actually, you've already answered it. Can you please post it as an answer, so I can give you the credits? Thank you again. – Diego Rafael Souza Apr 02 '18 at 21:13

1 Answers1

2

I think this will help you to understand

https://stackoverflow.com/a/39091491/3998265

In my opinion, to make things simpler, we can say that PCL is discovering references in every platforms, a specific version of the dll is created according to the targeted platform.

But .NET Standard load and embed that references, and is the same for every platform

Fabrice T
  • 648
  • 9
  • 23