News




Call Anirudha on Skype

Blogger

JavaScript Function .prototype

Download: Fast, Fun, Awesome



UPDATED 28 December 2013

 

In this post I am writing how to fix the MySql.Data.MySqlClient issue when server doesn’t make call to same library with same version that is used in development server.

Back in 2011 when we use Mysql I prefer simply to use .net connector. At the end of 2013 (december) I doesn’t like to use .net connector anymore. I personally hate it. In my another post I write it clearly  Don’t use MySQL .net connector, here is why ? Use nuget in Visual studio is best and easier option which doesn’t created problem like this I have in this post.

When you installed Mysql Connector and referenced the library you just referenced your project through library. Which doesn’t means your project have it. Your asp.net project just have reference to it.

When you deploy your asp.net project and server doesn’t have reference to same library it’s make a exception that version is not matching. Your server have another version which is different from the version which you currently installed on your development server.

For fix the issue go to

C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies

Remember that 6.3.6 is the version that I have used back in 2011. Currently latest version available at dev.mysql.com but I prefer nuget which make thing much easier.

There are some folder in it. for example

  • v2.0
  • v4.0

Remember that V2.0 is for .net 2.0 and v4.0. As rules you already know that older version of .net app can’t use library that is come from new version of .net framework.

You can copy the dll from this folder to your own project and referenced them from it’s own bin folder. In asp.net we manage the bin folder for having library. Some library are we made ourselves and doesn’t serve from GAC. All these library are stored in root directory’s bin folder. When you copy the dll don’t try cut/paste do copy paste. This dll maybe referenced in your visual studio or some other programs call it (because .net connector registered that they have a new kind of connectivity that is Mysql (just like ODBC). you will got trouble if those dll will be removed from the folder when a call made from any other program to these dll.

Now when you deploy the project you doesn’t need to care about the version of mysql. Your project is not calling the library that it’s have itself. Using nuget you doesn’t need to care about installing a new connector by download and run. You can use Package for solution option in VS to update your mysql connector

Thanks for read my post Smile


Comments

Gravatar # re: MySql.Data.MySqlClient version mismatched
Posted by Abdi on 12/28/2013 7:36 AM
thank you so much
Post A Comment
Title:
Name:
Email:
Comment:
Verification: