I am working on Desktop application with c# and Data base MySQL. When I install its installer on my machine it works fine but when I install it on other machine its give following exception when try to access DB. I am using MySQL.Data.dll
to communicate with MySQL.
Could not load file or assembly 'MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
and MySql.Data.dll
file in present in Project's folder in Program files folder
Actually when I run it from its folder in Program file it run fine with no error but When i try to run it from its shortcut in Start Menu it gives that error.
It sounds i am 2 years late answering this post but it might be helpful for those who are still facing this issue, so here is my finding dated 1st April 2012 5pm EST:
I had the same issue with one of my web application. And I found the said issue arises when you do:
MySql.Data.dll
somewhere in a folder.MySql.Data.dll
in GACThough application works fine on your development machine as it can see the files but when you deploy it on some other machine it actually brings the run time error.
In my case, the VS2008 always pointed me with the same error as you mentioned. I then did this:
Somebody asked "Where is GAC?":
http://msdn.microsoft.com/en-us/library/yf1d93sz(v=vs.110).aspx
Does the shortcut in the Start Menu set the working directory correctly? (I suspect that this is the most likely answer)
Is there a different/incorrect version of MySql.Data.dll installed in the GAC (Global Assembly Cache)? I've seen this give similar error messages before.
Is MySQL.data.dll present in the same directory as the .exe file ?
If so does that MySQL.data.dll have the proper version/public key that the .exe file is looking for ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With