Bug #78504 Code First from MySQL Database not creating model, connectionString
Submitted: 21 Sep 2015 16:41 Modified: 22 Sep 2015 19:02
Reporter: SCREW ORACLE Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Visual Studio Integration Severity:S1 (Critical)
Version:1.2.4 OS:Windows (8.1 x64)
Assigned to: CPU Architecture:Any
Tags: code first from database, Visual Studio, visual studio enterprise 2015

[21 Sep 2015 16:41] SCREW ORACLE
Description:
I have the following in a new ASP.NET MVC5 project:

 - VS2015 Enterprise 14.0.23107.0 D14REL
 - MySQL for VisualStudio 1.2.4
 - Connector/NET 6.9.7

Nuget:

 - EntityFramework 6.1.3
 - MySql.Data 6.9.7
 - MySql.Data.Entities 6.8.3
 - MySql.Web 6.9.7

And have the following in Web.config:

      <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>

Within Server Explorer I have a valid connection to a remote MySql Server instance and ability to read/write tables, etc. However, when I try to add an ADO.NET entity and select 'Code first from database', hit next, select the connection, mark "Yes, include the sensitive data in the connection string" and leave the "Save connection settings Web.Config as:" checked as well as the default name in the textfield and then hit next, Visual Studio seems to think a bit, shows a blank wizard panel (http://i.stack.imgur.com/Ezm4L.png) real quick, and then the wizard closes rather than bringing up a panel to select table objects, etc. Furthermore there are no models created nor is there a `connectionString` created in Web.config despite the wizard closing. I get the same issue with using a local MySql Server instance as well.

How to repeat:
Use the following in/with a new ASP.NET MVC5 project:

 - VS2015 Enterprise 14.0.23107.0 D14REL (might be possible to use another version)
 - Win8.1 x64 (might be able to use another version)
 - MySQL for VisualStudio 1.2.4
 - Connector/NET 6.9.7

Nuget:

 - EntityFramework 6.1.3
 - MySql.Data 6.9.7
 - MySql.Data.Entities 6.8.3
 - MySql.Web 6.9.7

And have the following in Web.config:

      <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>

Connect to a local/remote MySql instance using Server Explorer in VS and confirm you have read/write access. Try adding a ADO.NET entity using 'Code first from database' and using the MySql database in question. Click next. Instead of wizard panel with ability to expand database and select tables to use for model creation, the wizard should close unexpectedly.

Suggested fix:
Unknown
[22 Sep 2015 7:11] Chiranjeevi Battula
Hello SCREW,

Thank you for the bug report.
This is most likely duplicate of Bug #77887, please see Bug #77887.
Do not forget to rebuild the solution before attempt to add an ADO.NET Entity Data Model.

MySQL Visual Studio installing and configuring manual:
http://dev.mysql.com/doc/connector-net/en/connector-net-visual-studio-install.html

Thanks,
Chiranjeevi.
[22 Sep 2015 9:31] Claudia Stölzel
And in Bug #77887 there is no solution for this bug provided nor an example solution that works. 

I am sure you do a great job but in this case help is still missing. Error still occurs
[22 Sep 2015 19:02] SCREW ORACLE
@Chiranjeevi Battula

I've replicated Bug #77887 and posted about how I believe the root cause may be around Win8/8.1 given I've tried various Visual Studio and MySql4VS versions and keep running into the same issue. Please look at that bug, update the status of it to active or something similar, and help resolve that bug.
[30 Aug 2016 15:21] Jason Work
I know this is an old bug, but I had a similar situation and fix.

I also have the same problem of creating the code-first entity framework with the wizard, and having it immediately disappear after picking the DB, what to include in the connection string, etc.

I realized I had accidentally added to MySql.Data.Entity nuget packages to my project.  One was created by MySql and the other was created by Oracle.  I uninstalled the MySql version, and now it goes forward like normal.  I assume the problem is having two MySql.Data.Entity nuget packages installed at the same time, and removing one or the other should let you proceed in the wizard.

In a separate project I had the same problem, and I also had to remove the reference in the app.config file (this particular project was just a test console app).  The two versions were reference under <entityFramework><provider>...
[27 Nov 2016 5:38] cary abramoff
For anyone who has strugged to get EF6 code first to add tables to a MySQL db (I lost 2 days to this) here's what I finally ended up doing for my ASP.NET MVC/WebApi project.

Rather than create my own DbContext I used the ASP.NET Identity 2.0 context. Just add the DbSet to the context class and problem solved. I will be using the built in ASP.NET IdentityContext for all EF6 coding. 

Caveat: I am calling my database, "dbo" to avoid the bug where add-migration insists on prefixing all tables with the "dbo" schema.

Hope this helps someone.