4

I am currently getting the following error. On a locahost website.

Could not load file or assembly 'MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Though, the reference is definitely there in the references folder and that dll is definitely on my local machine in the place it is pointing to. I have also tried deleting and re-adding the reference.

Does anyone know what would cause this error?

Also what is the assemblys manifest definition?

Thanks in advance for the help, I very much appreciate it.

recneps
  • 1,285
  • 5
  • 16
  • 27
  • I hate this issue - i've seen it myself before, for the heck of it, is the dll showing up in the bin? – 99823 Apr 10 '13 at 00:27
  • Also - are you certain the version you are using is 6.5.4.0? – 99823 Apr 10 '13 at 00:28
  • http://stackoverflow.com/questions/215026/the-located-assemblys-manifest-definition-does-not-match-the-assembly-reference – 99823 Apr 10 '13 at 00:28
  • Hi, yes the dll is showing up in the bin. Though I am actually using 6.6.5.0. I think I am just going to download 6.5.4.0 and hope that sorts me out. – recneps Apr 10 '13 at 00:30
  • What I do not understand is that there is no place in my code that specfically references 6.5.4.0 or any version... – recneps Apr 10 '13 at 00:31
  • 1
    Usually - when I've encountered this in the past the references were in my web.config - maybe you will see it referenced there? – 99823 Apr 10 '13 at 00:32

7 Answers7

9

in visual studio select the reference in the solution explorer then in the properties make sure the Specific Version property is set to false.

If you have an entry for this reference in the web.config, edit the file and remove the version information.

if you close visual studio and open the project file with a text editor, make sure in the project file the version of the assembly is not listed but only the name and type, so just remove the following:

, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'

then it should work no matter if you are using the 6.5.5 or 6.5.4, as long as the code is using classes and methods available in both.

Davide Piras
  • 43,984
  • 10
  • 98
  • 147
1

I have experienced the same situation and managed to fix the problem with these steps,

Read the error information carefully which provides helpful details to rectify the situation. I wouldn't change the machine.config file. As it says Application cannot find a reference to the assembly MySql.Web and the version it is trying to reference is Version=6.7.4.0.

Based on path you install MySql you will be able to find the correct assembly files, ex :

C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\MySql.Data.dll

Copy that file to bin folder. (I would copy all the files in C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\ folder to bin folder)

Hope this helps! Thanks

kleopatra
  • 51,061
  • 28
  • 99
  • 211
Twayta
  • 11
  • 1
0

I have encounter the same problem very few days ago , you get this error when you have build your some DLL with earlier version and now you have change the dependent DLL version but had not build the DLL again . Please check if you have any component which was build on the earlier version . While we build any DLL , DLL it self in the manifest add all the dependency information so that it can load all of them when required . So if you remove that version of DLL you need to recompile all the component and then use

Devesh
  • 4,500
  • 1
  • 17
  • 28
0

This problem persists also in newer version of MySql.Data. Just change the version from App.config file:

<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-6.6.5.0" newVersion="6.6.5.0" />6.7.4.0

to oldVersion="6.6.5.0"

<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
    <bindingRedirect oldVersion="6.6.5.0" newVersion="6.7.4.0" />
GeorgesC
  • 145
  • 4
  • 15
0

I had this in an older asp.net 2.0 website on a new machine. In my case, the MySql assembly from the GAC could not be loaded because it was .Net 4.0. Assembly redirect in web.config did not work. I fixed it as follows:

Berend Engelbrecht
  • 1,420
  • 15
  • 11
0

I was getting the same error and the file absolutely existed. If you see a SGEN next to your error, you can try this:

In the project properties window go to Build and in the Output section go to the Generate serialization assembly dropdown. Change the value Auto to Off and Build again.

You can set it back to auto if you need it.

0

In some situations, it depends on bindingRedirect attributes in web.config file of the project. In my case, I had two version: olderVersion and newVersion. I just switched those values and it solves the problem.

WARNING: Be sure that the newer version is referenced into web.config assemblies' tag file just as : <add assembly="$AssemblyName", Version=$NewVersion, Culture=neutral, PublicKeyToken=$KeyToken/>

Aymeric Loos
  • 11
  • 1
  • 3