[Mono-osx] How to include MySQL.Data library

Jonathan Pryor jonpryor at vt.edu
Fri Jan 28 13:16:51 EST 2011

On Nov 1, 2010, at 8:29 AM, jsn wrote:
> I just downloaded the driver for MySQL 
> mysql-connector-net-6.3.5-noinstall.zip and installed following the
> indication in this link
> http://dev.mysql.com/doc/refman/5.0/en/connector-net-installation-unix.html
> and when I compile it using the command line I get the following error
> message: 
> j-iMac$ gmcs -r:System.dll -r:System.Data.dll -r:MySql.Data.dll Main.cs
> error CS0006: cannot find metadata file `MySql.Data.dll'
> Compilation failed: 1 error(s), 0 warnings

The installation instructions are incomplete, as they install the assembly into the GAC (via gacutil) but they don't place the assembly anywhere that the compiler will find it (as the compiler doesn't look for assemblies within the GAC, but instead within the same directory as the compiler itself, e.g. /Library/Frameworks/Mono.framework/Libraries/mono/2.0).

Consequently, you also need to copy MySql.Data.dll "somewhere" (e.g. ~/Assemblies) then reference this location:

	gmcs HelloWorld.cs -r:System.Data.dll -r:$HOME/Assemblies/MySql.Data.dll

 - Jon

More information about the Mono-osx mailing list