1 minute read

2 Year ago I write a post here to give my view on Mysql and it’s nuget packages http://geekswithblogs.net/anirugu/archive/2013/11/04/donrsquot-use-mysql-.net-connector-here-is-why.aspx

Nuget package is much better way to fix the dll. Just type the command in console and reference has been added to your C# project very easily. You don’t need to do anything to update it every time.

Visual studio make this process easier.

From last few days I got a trouble. When I share with my code with other it’s not work on another machine which have Mysql Connector installed on the system.

Everytime I take there code and compiled on my machine and give them back it’s not working there. Nuget installed the nuget packages again and it’s use nuget packages reference there and it’s installed on there machine which make trouble on c# to run them.

The code will be compiled, Warning will be shown in Error in visual studio. But because Connector have a DLL installed in GAC it will make issues that “not matched“.

Now to fix this issues try this trick.

Open the csproj file of your project. Search for mysql

replace it with this code, Previously it’s referenced from packages folder, Now if you are making reference from bin folder it will work.


False
..\projectname\bin\MySql.Data.dll
True

projname is your own projectname. Now it’s called the dll from your bin. Change the path according to your project location.

Now open the packages.config and where it’s stored the packages settings. Now remove the mysql reference from there but cut the line that have mysql.

If you have attached many project to your project do same on that too if they have mysql too.

Now it fixed. Now VS will not download the dll from Nuget again and again. Now they are calling it from Bin folder.

Yahooooooo. Now Nuget can’t burn my minutes to just fix them again and again.

Happy Coding Smile

Updated: