-
Install MySQL Server 8.0.16
-
Install Complete MySQL Connector.Net x86 8.0.16
-
Install this custom repacked VSIX MySQL Visual Studio
-
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
in Visual Studio Nuget package manager console -
Manage Nuget Packages > Search Mysql > install Mysql.Data v8.0.16
-
Manage Nuget Packages > Search Mysql > install Mysql.Data.Entity v6.10.8
-
Manage Nuget Packages > Search Mysql.Data.EntityFramework > install Mysql.Data.EntityFramework v8.0.16
-
Comment the following kind of similar code from
Web.config
which is already added by the project
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider><provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.16.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider></providers>
</entityFramework>
- Add this lines if its not automatically added after
</runtime>
tag inWeb.config
and rebuild solution
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<!--<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider>-->
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.16.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider>
</providers>
</entityFramework>
- Comment
<compilers>
inWeb.config
as per below
<system.codedom>
<!--<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>-->
</system.codedom>
-
Even if doing all the above process some error occurs, then try uninstall nuget packages all the above added and
UnInstall-Package EntityFramework
uninstall visual studio plugin and connector net. Then rebuild fresh project, and add onlyInstall-Package EntityFramework
and then add references only Mysql.Data and Mysql.Data.EntityFramework for EF6 and then add the provider xml in web.config as mentioned above and remove the white space between the<provider>
and</provider>
tags, and rebuild project and finally try to add model. -
This process is tested and working for .Net Framework 4.7.2 on Visual Studio 2019
Thank you