MySQL : version of MySql.Data couldn't load c# entity-framework mysql


I use Entity FrameWork 5.0 and MySql connector 6.7.4 . I have a simple MVC Razor 4 application. When I start my appliaction there is an error like this :

Could not load file or assembly 'MySql.Data, Version=, 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)

I tried that unload and load my MySqlData dll from NuGet but it didn't work. What should I do?

11/2/2013 9:09:16 AM

Accepted Answer

As you are using EF5 a corollary is that you have to use version 4.5 of the framwework. This then requires that you use version of the MySql connector libraries as you've stated, yet your error implies that you are using version for .Net 4.0.

You need to remove the current version you have and download the correct version from NuGet. Alternatively, you can download directly from the MySql Dev site

Also, make sure that you reference MySql.Data, MySql.Data.Entity and MySql.Web in your application, and that they are all version

You may also need to update the <> section of your web.config. Try this:

        <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
11/2/2013 9:26:58 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow