Unable to use Mono.Data.Sqlite.dll in Visual Studio

0

Good afternoon,
I wrote some code with MonoDevelop on Linux. The program that i'm writing use Sqlite to store datas, so i've imported the Mono.Data.Sqlite, and it work perfectly.

MonoDeveloper imported libraries

When i tried to copy the project on Windows and opened with Visual Studio 2019, i've got some troubles.

First of all, VS tells me that the library was not found.

VS2019 imported libraries

When i try to compile VS throws me the error CS0246, that says that the type or namespace name "Mono" could not be found.

I've tried to reimported the Dll. The library was imported successfully, so that the code compiles without problems, but when I try to run the program, another error is thrown:

System.BadImageFormatException

Could not load file or assembly 'Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. (HRESULT:0x80131058).

I'm compiling with x86.

Thanks for your help!

c#
sqlite
mono
visual-studio-2019
monodevelop
asked on Stack Overflow Nov 9, 2020 by Davide Parisi

1 Answer

1

In some cases, especially when moving project on a another computer, the following steps can help to prepare environment to compile projects, that require the NuGet Mono.data.sqlite package:

  1. Remove reference to the Mono.Data.sqlite from the project's references.
  2. In the Visual Studio go to ToolsNuGet Package ManagerManage NuGet Packages for Solution... Then select Browse, find Mono.data.sqlite package and install it.
  3. Recompile the solution.
answered on Stack Overflow Nov 10, 2020 by Jackdaw

User contributions licensed under CC BY-SA 3.0