[Mono-dev] Problem with compiling using MySQL library

Rafael Teixeira monoman at gmail.com
Mon Oct 2 10:46:20 EDT 2006

The compiler won't use the GAC installed library as a reference. You
need to give it dll in the current directory or a full path to a
specific dll, to make sure which version of a library you are
referencing (the GAC can contain many different versions of the same

Copy the MySQl.Data.dll library to the directory your sources are or
reference it with a relative or absolute path like:

cd src && gmcs -r:../lib/MySQL.Data.dll mysource.cs

The above example assumes sources on ./src and referenced libs on ./lib.

The System.* libs doesn't need to be copied to be referenced as the
compiler finds them not because they also are in the GAC but because
they are installed in the same directory as the compiler.


On 10/2/06, Kenneth Jensen <xmlsec at gmail.com> wrote:
> Hello,
> I am trying to compile a small hello-program which will open a
> connection to a MySQL database, but the mcs compiler fails because it
> can't find the MySQL library ( I am running Fedora 5 Linux).
> I have installed the MySql.Data.dll into the GAC, using "gacutil -i
> MySql.Data" and I can even confirm its existence and version:
> [kaj at adm7-203 w5]$ gacutil -l MySql.Data
> The following assemblies are installed into the GAC:
> MySql.Data, Version=, Culture=neutral,
> PublicKeyToken=8e323390df8d9ed4
> Number of items = 1
> [kaj at adm7-203 w5]$ mcs MySqlExample.cs -r:System.Data -r:MySql.Data
> error CS0006: Cannot find assembly `MySql.Data'
> Log:
> Compilation failed: 1 error(s), 0 warnings
> [kaj at adm7-203 w5]$
> I'm quite new to Mono, so forgive me if I have missed something
> obvious, but should I do anything else besides installing new modules
> into the GAC, for the compiler and runtime to be able to reference
> them?
> ---
> Cheers,
> Kenneth
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

Rafael "Monoman" Teixeira
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw

More information about the Mono-devel-list mailing list