samedi 7 novembre 2015

Unable to connect to SQlite using mono

In my program I have this simple code:

using System;
using System.Data;
using Mono.Data.SqliteClient;

.... 
IDbConnection cnx = new SqliteConnection("URI=file:reestr.db");
cnx.Open();
....

And this is how I compile it:

$ mcs Test.cs -r:System.Data.dll -r:mono.data.sqliteclient.dll

It compiles ok. But when I run it with ./Test.exe, I get this error messages:

Missing method .ctor in assembly .... Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Data.SqliteClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. File name: 'Mono.Data.SqliteClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'

I'm not sure what I'm doing wrong here and how to repair it.

PS. I'm using Ubuntu as my OS.

Aucun commentaire:

Enregistrer un commentaire