What I had to do was reinstall MySQL for Visual Studio 2.0.5, then completely remove and install MySQL Connector 6.9.9. Seems the order does matter. After that, I completely remove these packages, and reinstalled in this exact order:
(restart Visual Studio afterward)
EntityFramework 6.1.3 (I tried earlier versions and they don't work, so beware)
Mysql.Data 6.9.9
Mysql.Data.Entity 6.9.9 (NOT Mysql.Data.Entities!!! [for 6.9.9])
Mysql.Web 6.9.9
Then, make sure the following is in your web.config file:
(restart after editing to be sure)
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
(you may have to comment out any existing section and replace it with this one)
The last step I had to remind myself by revisiting here.
That part is what I forgot about (been too long), which caused the error in the screenshot in the question.
One last thing, you may have incorrect versions copied to where Visual Studio is installed; for example:
C:\Program Files (x86)\Microsoft Visual Studio\
{Year}\
{Community|Enterprise|Professional}\Common7\IDE\PrivateAssemblies
or
C:\Program Files (x86)\Microsoft Visual Studio
{Your Version Number}\Common7\IDE\PrivateAssemblies
MySql.Data.dll
MySql.Data.Entity.EF6.dll
MySql.Web.dll
(may have to close Visual Studio first)
You can select each file and go to the Details
tab under the file properties to see what versions you have.
Get the new files from here (or wherever you installed it):
C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.9\Assemblies\v4.5
(this assumes Connector v6.9.9 using framework v4.5 [see your project properties' Application->Target Framework
to confirm your setting]).
Note 1: When you install MySQL for Visual Studio, it updates the files in the PrivateAssemblies
folder (see the Visual Studio paths above), so PLEASE double check the assemblies above to make sure they didn't get changed to anything other than your target version (6.9.9 in this case). Regardless of what NuGet installs, Visual Studio won't even care, and will look in the private assemblies (I think during startup actually).
Note 2: If you get an "IsPrimaryKey" error, see here.
My completed App.Config that works for reference (to compare with yours):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
</providers>
</entityFramework>
<connectionStrings>
<!-- Connections Strings Go Here -->
</connectionStrings>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.9.9.0" newVersion="6.9.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>