Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pishangujeniya/41a051572a471fa0311a8f4f6d0c5332 to your computer and use it in GitHub Desktop.
Save pishangujeniya/41a051572a471fa0311a8f4f6d0c5332 to your computer and use it in GitHub Desktop.
MySQL Server 8.0 with Visual Studio 2017 and EntityFramework Install Guide

Installing MySQL 8.0 Server with EntityFramework in Visual Studio 2017

  • Install MySQL Server 8.0

  • Install Complete MySQL Connector.Net x86 8.0.16

  • Install Complete MySQL Visual Studio Plugin 1.2.8

  • If after installing MySQL Visual Studio Plugin it shows warning that failed to execute comamnd devenv /updateconfiguration, then manually execute that command in Developer Command Prompt for Visual Studio 20xx with run as administrator.

  • Run this command Install-Package EntityFramework -Version 6.4.0 in Visual Studio Nuget package manager console

  • Run this command Install-Package MySql.Data -Version 8.0.16 in Visual Studio Nuget package manager console

  • Run this command Install-Package MySql.Data.EntityFramework -Version 8.0.16 in Visual Studio Nuget package manager console

  • Comment the following kind of similar code from Web.config

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient"
          type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"/>
      <provider invariantName="System.Data.SqlClient"
          type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityFramework>
  • Add this lines if its not automatically added after </runtime> tag in Web.config and rebuild solution
<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.16.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  • This process is tested and working for .Net Framework 4.7.2

Helpers

@jayprajapati857
Copy link

jayprajapati857 commented Apr 18, 2019

Thanks, you saved my lot of time. 😃😃😃

@mrlamb
Copy link

mrlamb commented Aug 25, 2019

Thank you for this. I've spent two days installing different packages, trying different app.config changes and nothing worked. I didn't follow your instructions to the letter but you got me there anyway. Thanks for clear instructions. The key element for me seemed to be removing the mention of EF6 that was placed by God knows what. After that I got rid of the trailing and the whitespace as a whole. That fixed my "wrong version" problem. Lastly I noticed I was on a different version (8.0.17 which is most current as of time of this writing) so I changed that in the app.config. This fixed my "wizard disappears without seeming to do anything" problem.

Wanted to leave this note here for anyone who's searching for an answer. Your post was great!

@CliffConway
Copy link

Thanks for your very detailed steps. This got me beyond the original error "Your project references the latest version of Entity Framework; however, an Entity Framework database provider compatible". However, now I get the "wizard disappears without seeming to do anything" issue. I have spent over 2 days on this and I am losing the will to live. Any clues anyone. Thanks in advance,

@mrlamb
Copy link

mrlamb commented Oct 31, 2019

For me it was an XML error that wasn't caught in the error list. In the connection strings scroll all the way to the right and make sure everything tag is opened and closed properly. You might see a blue squiggle indicating formatting error.

@CliffConway
Copy link

Yeah, I did notice the blue squiggle. I corrected that but still the wizard disappears. Driving me crazy.

@JestDandruff
Copy link

For anyone still having this issue, follow this to the letter but take the newest versions for all of the NuGet packages except the Google Protobuf, use the version listed above (I used Mysql.Data v8.0.19, Mysql.Data.Entity v6.10.9, Mysql.Data.EntityFramework v8.0.19). Then update the XML tag for "Version=8.0.15.0" to the version you used This worked for me after I experienced the different status messages and wizard crashes.

@eyeveye
Copy link

eyeveye commented Jul 12, 2021

Proven is working! Thanks!

@eyeveye
Copy link

eyeveye commented May 29, 2022

Trying to update all the latest package, however the below combination is not working. It will not allow you to add the Entity Model:
EntityFramework 6.4.4
MySql.Data 8.0.29
MySql.Data.EntityFramework 8.0.29
MYSQL Connector/NET 8.0.29

This combination works:
EntityFramework 6.4.4
MySql.Data 8.0.28
MySql.Data.EntityFramework 8.0.28
MYSQL Connector/NET 8.0.28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment