tags:

views:

102

answers:

2

Hi. On Windows, I installed MonoDevlop and tried compiling the SQLite example which requires the Mono.Data.SQLiteClient reference. I opened up "Edit References" within MonoDevelop and I have absolutely no Mono references available with the exception of Mono.Cairo and Mono.Posix.

I thought perhaps I'd made a mistake by no installing the Mono framework first, so I installed Mono, then did a repair installation on MonoDevelop but the references are still not there?

Can somebody help me please?

Cheers Sparky

A: 

Firstly, I believe Mono.Data.SqliteClient has been deprecated in favour of Mono.Data.Sqlite.

By default, MonoDevelop on Windows targets the .NET runtime for building/running/etc. The libraries available in the "Edit References" dialog are those installed into the target runtime, i.e. .NET.

If you have Mono installed, you also have the choice of targeting Mono. You can change the default target runtime using the Preferences->.NET Runtimes options panel, or change it for only the current solution using the Project->Active Runtime Menu.

Regardless which runtime you build with, you should be able to run/debug with another runtime using the Run->Run With... menu.

You could also install Mono.Data.SQLite into the .NET AssemblyFolders.

mhutch
Perfect!! Thanks mhutch. It works. Very happy now - I can start some serious cross-platform development for PC and Mac.
Sparky
A: 

Ermm.. I think I jumped the gun. I've managed to build the SQLite test app with MonoDevelop after changing the .Net Runtimes as you suggested. Only problem now is that when I try to run my program, I get a DLLNotFoundException with the parameter of "sqlite3".

Can you help me please? I thought SQLite support was completely built into MonoDevelop already - thats why I've been so confused in getting it all working. Is there another SQLite DLL that I need to include or download?

Cheers Sparky

SparkyNZ
Yes, Mono.Data.SQLite is a P/Invoke wrapper around the native sqlite3.dll. With Mono, this might be handled by DllMaps in the dll.config, but with .NET you'd have to make sure you have the native sqlite3.sll library in your DLL loading paths - i.e. your app's directory, or PATH.
mhutch
See http://msdn.microsoft.com/en-us/library/ms682586%28VS.85%29.aspx for info on windows dll search paths. On Linux you can expect libsqlite3.so (the equivalent of sqlite3.dll) to be in the default search paths.
mhutch
Thanks - I take it on a Mac there'd be an equivalent 'DLL' type of file that would also need to sit in the same path as the executable?
Sparky
Yes, on Mac it's .dylib. I'd guess sqlite is probably in the default system paths or mapped via a Mono config dllmap. Note also that you can use environment variables in your app's launch script to add native library search paths: LD_LIBRARY_PATH on Linux and DYLD_FALLBACK_LIBRARY_PATH on MacOS.
mhutch