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=184.108.40.206, 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?
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
220.127.116.11 of the MySql connector libraries as you've stated, yet your error implies that you are using version
18.104.22.168 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.Web in your application, and that they are all version
You may also need to update the
<system.data> section of your
web.config. Try this:
<system.data> <DbProviderFactories> <clear/> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=22.214.171.124, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> </DbProviderFactories> </system.data>