Page 1 of 1

Referenced MySQL.Data.dll is not being loaded properly

Posted: Mon Mar 03, 2014 3:48 pm
by kmck
Hello,

I have a custom .dll I use in most of my tests, and that custom .dll references and uses the MySQL.Data.dll. I noticed that when I ran the test on a different system, I got the following error:

Code: Select all

Could not load file or assembly 'MySql.Data, Version=5.2.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified. 
I then added the MySQL.Data.dll reference to my test (in addition to my custom .dll that references MySQL.Data.dll), yet still received the same error when ran on a separate machine.

I then noticed that MySQL.Data.dll was not being copied into the bin/debug folder. Once I copied it into that folder, the test ran just fine.

I may be wrong, but should I not have to re-add MySQL.Data.dll to my test references if a referenced .dll references MySQL.Data.dll in itself? Also, when explicitly adding the dll reference, should it not copy that into the bin/debug folder, or at least be able to reference it properly from GAC?

Any insight into why this error would occur would be greatly appreciated!

Re: Referenced MySQL.Data.dll is not being loaded properly

Posted: Tue Mar 04, 2014 3:51 pm
by Support Team
Hi kmck,

Please make sure that the property "Local Copy" is set to true in the "Properties" dialog of the reference.
To get the properties dialog make a right click on the reference and select the Properties option in the context menu.

Regards,
Bernhard

Re: Referenced MySQL.Data.dll is not being loaded properly

Posted: Mon Mar 10, 2014 3:22 pm
by kmck
That did it! Sometimes it's the simplest things. Thank you.

Re: Referenced MySQL.Data.dll is not being loaded properly

Posted: Tue Jun 10, 2014 4:56 pm
by jdorfsman
Hi! I have my reference set to local and I am still getting that error..
I tried to add it to the GAC with "gacutil -i ~/Projects/Forums/Dlls/mysql.data.dll"
but got this error: Failure adding assembly /home/jdorfsman/Projects/Forums/Dlls/mysql.data.dll to the cache: the filename "mysql.data.dll" doesn't match the assembly name "MySql.Data"
Any thoughts?

Re: Referenced MySQL.Data.dll is not being loaded properly

Posted: Mon Jun 16, 2014 3:12 pm
by Support Team
Hi,

Have you already tried to create the DLL with the name "MySql.Data" instead of "mysql.data"?

Regards,
Markus