2

Connector is installed in gac:

nn@sv3:~/mysqlconnector.net/v4.5$ gacutil -l |grep MySql
MySql.Data, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d

I have added MySql.Data to machine config:

nn@sv3:/$ cat /etc/mono/4.5/machine.config |grep MySql
    <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
        type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

When I try to comile with ref to MySql.Data I get:

nn@sv3:/$ sudo ./build.sh
error CS0006: Metadata file `MySql.Data.dll' could not be found

I have tried to changed ref with full path and both MySql.Data and MySql.Data.dll

Here is the compile command:

dmcs -target:library -out:SQLtest.dll -pkg:dotnet -lib:/usr/lib/mono/2.0 -lib:/usr/lib/mono/4.5 -r:MySql.Data -r:*.cs

Have also tried to use v4.0 with same result. What am I missing to get this working?

beppe34
  • 21
  • 2
  • Have you downloaded its Mono special version? You cannot use the Windows version in most cases as it might be a mixed assembly that Mono does not support at all. – Lex Li Oct 08 '15 at 02:07
  • I am using the package named .Net & Mono from dev.mysql.com. The downloaded file is named mysql-connector-net-6.9.7-noinstall.zip ... and I think it´s the right one. – beppe34 Oct 08 '15 at 09:27
  • My testproject will compile if I copy the MySql.Data.dll to my project folder. But when i then are trying to use MySql - following exception is thrown: `System.TypeLoadException: Could not load type 'System.Security.SecurityRulesAttribute' from assembly 'MySql.Data'` – beppe34 Oct 08 '15 at 09:31
  • @LexLi: Is it still the case that one needs a special version for Mono? – Oskar Skog May 18 '21 at 19:18
  • @OskarSkog the rule of thumb in 2021 is to use .NET Core instead of Mono and there you can find a suitable official MySQL related NuGet package to use. – Lex Li May 19 '21 at 00:07

0 Answers0