2010-06-04 15 views
5

Ho scaricato System.Data.SQLite e ho provato a compilare il seguente codice di esempio.Come utilizzare System.Data.SQLite in mono?

 
using System; 
using System.Data; 
using System.Data.Common; 
using System.Data.SQLite; 

namespace test 
{ 
    class Program 
    { 
    static void Main(string[] args) 
    { 
     SQLiteConnection.CreateFile("/Users/smcho/Desktop/SQLite-1/example/mydatabasefile.db3"); 
    } 
    } 
} 

Ho eseguito il seguente comando

 
mcs db.cs -r:System.Data.dll -r:System.Data.SQLite.dll 

Ma, ho ricevuto i messaggi di errore come segue.

 
** (/opt/local/lib/mono/1.0/mcs.exe:43249): WARNING **: The class System.Data.Common.DbConnection could not be loaded, used in System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 
db.cs(12,7): error CS0103: The name `SQLiteConnection' does not exist in the current context 
Compilation failed: 1 error(s), 0 warnings 

Cosa potrebbe essere che non va?

risposta

4

L'utilizzo di gmcs anziché di mcs ha risolto questo problema.

 
gmcs db.cs -r:System.Data.dll,System.Data.SQLite.dll 
+0

mcs è morto ora (per .NET 1.x/Mono 1.x). dovrebbe essere usato gmcs (per .NET 2.0 +/Mono 2.x). –