0

I'm trying to write an android/iOS, xamarin forms app using visual studio on a mac. I can add a nuget package and compile but when I run it (on both iOS and android) I get the System.DLLNotFoundException.

This happens with many nuget packages but here's the simplest example.... I create a new multi-platform blank forms app use .NET Standard add System.Data.SQLite.Core nuget package add "using System.Data.SQLite;" to my .cs file

Then I add this line of code anywhere...

SQLiteConnection db = new SQLiteConnection();

and I am getting exception on that line

Where are these libraries stored and how do I get them to deploy with my app when I'm running/debugging?

Uday Ramjiyani
  • 1,407
  • 9
  • 22
CDP
  • 13
  • 2
  • The libs are inside the application file. Did you check that you added all the nuget packages needed for SQLite? Oh and maybe try to add the Nuget packes also inside the platform projects – DirtyNative Oct 11 '18 at 13:50
  • Hi CDP. Without the wider context of your code, its hard to say exactly what the issue is. My educated guess would be that you haven't added the nuget package to every project in your solution. For example, if you've only added the package to your .NET Standard library you won't get a compile time error because the package is referenced in that assembly, but you'll get a runtime error because the Android or iOS project doesn't also have the correct assembly loaded. Also, check the documentation for the package. It may required you doing some platform specific initialization. Good luck. –  Oct 11 '18 at 14:06

1 Answers1

0

I am not sure if this is the problem, but maybe the nugets you had imported are not designed for the Forms App. Try using SQLite.Net-PCL

DirtyNative
  • 2,553
  • 2
  • 33
  • 58
  • You're probably right. When looking at all the packages, how do I know which ones are compatible? – CDP Oct 11 '18 at 14:08
  • I don't know if there is any text pointing this out, but always read the documentation and example code. This most of the time indicates which to choose. Tell me if this Nuget solved your issue – DirtyNative Oct 11 '18 at 14:30
  • separate question but you may can help... do you know of a sqlite library that supports the attach database command so I can join tables from 2 different files? – CDP Oct 11 '18 at 15:13
  • Unfortunatly not, but I never used SQLite before, so maybe someone else can help you – DirtyNative Oct 11 '18 at 16:30