Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm trying to add an edmx Entity model to my C#/Web Project in Visual Studio 2013. My problem is that the file is not created.

I do the following steps:

  • Give the item a name
  • Choose 'EF Designer from database'
  • Choose the connection from the drop down (localhost) that already tested successfully connecting to MySQL databse
  • The "Save connection settings in webc.config as" option is checked
  • I click 'Next' AND the window disappeared and I get back to the code window
  • No edmx file is created. (although it works with SQL Server, but not for MySQL)

    I have Entity Framework 6.1.2 installed, MySql.Data , MySql.Data.Entities , MySql.Data.Entity , MySql.Web -- all installed.

    I also rebuilt the project before trying to add an entity model file.

    I've installed the latest MySQL package with the latest .NET connector .

    Running: Visual Studio 2013 on Windows 7.

    Any ideas how to solve this?

    Any possibility that the file was created but not included in the solution automatically? Yasir Jan 30, 2015 at 18:29 @Yasir Yes, it is there. I tried "update model from database" again from within the designer (diagram), but it just closes the window without doing anything. Liron Harel Jan 30, 2015 at 18:31 can you attach screenshots of your solution explorer and the folder structure you have? Next, if you see the edmx file open, close it, right click on it and open with XML editor. Search for the words 'error' and 'exception' and post what you find. Yasir Jan 30, 2015 at 23:33

    I just had the same situation when trying to configure Visual Studio Professional 2017 environment with MySQL, ADO.NET (Database First) and EF6.

    Note: Please follow steps in the same order.

  • Uninstall/remove "Connector/NET" and "MySQL for Visual Studio" if installed.

  • Install "MySQL for Visual Studio" v2.0.5 CTP ( MySQL for Visual Studio ). Note: Install MySQL for Visual Studio before Connector/NET.

  • Install "Connector/NET" v6.9.10 ( Connector/Net ). https://i.stack.imgur.com/XOT1I.jpg Note: I tried using Connector/NET v6.8, v6.10 and v8 first, but none of them worked with Visual Studio 2017 and ADO.Net. Here you can find all Connector Versions and Compatibilities with Visual Studio IDEs , but so far this list is inaccurate.

  • Create new Visual Studio Professional 2017 project.

  • Download and Install "EntityFramework" v6.2.0 through NuGet, by going to Project Tab/Manage NuGet Packages/Browse -> Entity Framework.

  • Add references to C:\Program Files (x86)\MySQL\Connector.NET 6.9.10\Assemblies\v4.5\MySql.Data.dll C:\Program Files (x86)\MySQL\Connector.NET 6.9.10\Assemblies\v4.5\MySql.Data.Entity.EF6.dll ; by Right Clicking over References inside Solution Explorer and selecting Add Reference/Browse ->Browse button.

  • Add MySQL EF6 provider info inside App.config under entity framework providers as follow:

    <entityFramework>
           <providers>
             <provider invariantName="MySql.Data.MySqlClient"
                  type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
           </providers>
    </entityFramework>
    
  • Rebuild project by going to Build tab/Rebuild ProjectName.
  • And that's it. VS2017 is ready to go. Hope this works for everybody, as it did for me today.

    References:

  • Can't Create Entity Data Model - using MySql and EF6

  • No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider

    This should be the accepted answer. Well-documented and explains everything in very good detail. Solved my problem. I know this was added after the "accepted answer", but this should now replace it. Thank you! – Boyd P Dec 31, 2017 at 21:27 Deserves many upvotes, have been looking for this for so long, the only solution that's very clear an that actually works! – JoaVer May 31, 2018 at 20:09 This absolutely works! I'm very surprised and happy for the moment. Although, it's sad that we as programmers have to get our hands so dirty just to use a feature of software that should already work. I performed Step 6. just a bit differently because I didn't want to browse. I simply typed "MySql" in the search box of the "Reference Manager" form and selected the two required assemblies that way. – Bradley Nov 14, 2019 at 23:45
  • Uninstall MySql.Data.Entities from Nuget by using command below in Package Manager Console: Uninstall-Package MySql.Data.Entities

  • Add project reference to the latest MySql.Data.Entity.EF6.dll from your MySql connector installation path at: C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.8\Assemblies\v4.5

  • thanks for the tip. worked for me. What I don't get is why have a nuget if its not going to work ... – katesky8 Oct 29, 2016 at 1:30

    On my system, I had MySQL Connector 6.9.6.
    Issuing the command in NuGet Package Manger Console:

    Install-Package MySql.Data.Entity
    

    installs version 6.9.8 by default. Your connector must match the actual version of the NuGet Package.
    You can download an updated version of the connector from: https://www.mysql.com/products/connector/

    Here select the "Ado.net driver for MySQL", and download the corresponding version (in this case 6.9.8). Reopen Visual Studio and now the wizard does not crash. No reboot required.

    This solution worked for me with VS2015 and connector 6.9.9. The other suggestions on SO did not work for my setup. up voted. – Yogi Sep 3, 2016 at 22:00 had the same issue of the wizard failing but had the correct version. Had to uninstall the connector and reinstall and all good. A repair didnt work. – PodTech.io Jun 30, 2017 at 7:27

    This is for an ASP.NET MVC application, which does not have an app.config file. I will not recount the failed attempts, but what worked for me was the following:-

  • With VS not running, download and install "MySQL for Visual Studio 2.0.5" - the latest version at time of writing.
  • Start VS2017 and uninstall the "MySql.Data.Entity" and "MySql.Data" NuGet packages, if they have been previously installed in VS2017.
  • Download and install the latest MySql connector/NET using the links above (version 8.0.13 at time of writing).
  • In your project add references to the "MySql.Data.dll" and "MySql.Data.EntityFramework.dll" dlls as described above by Lopez93, but N.B. the "MySql.Data.Entity.EF6.dll" mentioned did not exist in 8.0.13, only "MySql.Data.EntityFramework.dll".
  • Now edit the web.config file and make sure that in the section, there is this line
  • <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework">

  • Remove or comment out any other '<provider invariantName="MySql.Data.MySqlClient"...' lines.

  • Rebuild the project.

  • Try using the wizard again.

    For me this worked.

    Good luck!

    This solved my issues instantly (using MySql.Data v 8.0.15), check the provider in the entityFramework section. This is gold, been working for 2 days now on this, reckon I've tried all the old advice, was about to give up. – Chris Schaller Apr 2, 2019 at 22:27
  • Open MySQL Installer and install the latest version of Connector/NET
  • Uninstall / reinstall the latest version MySQL.Data.* packages with versions that match the version of the newly installed Connector/NET package
  • Restart Visual Studios
  • Rebuild solution
  • Taking suggestions about NuGet versioning from others answers. I solved this issue by deleting the .Data and Data.Entitiy.EF6 installed by Nuget.

    Then right click on References and browse for:

    C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5\MySql.Data.dll C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5\MySql.Data.Entity.EF6.dll

    I was then able to complete the ADO.Net wizard, with the .edmx models.

    I know the solution.

    Nuget installs edge version of MySql.Data.* packages, while you probably have previous version of the connector (In my case packages were v. 6.9.6 and Connector was 6.9.5). This comes to the point where you have version mismatch.

    Be aware that if you use Install-Package MySql.Data.Entities in NuGet you will get even older version like 6.8.3, so you have to add the references by yourself and keep an eye on which one you are trying to add to your solution.

    I have tried all manner of combinations and this still doesn't work. The system tries and shows all the right dialogs but still creates no model. I've just rolled my own, not as good but it will do as I have no more time to give to this – djack109 Mar 27, 2018 at 20:59

    I ran into this issue upgrading from version 6 of MySql to version 8.0.17.0. I struggled with this for almost two days trying all of the old remedies until I came across this article. If you are using EF6 and version 8.0.? of MySql, according to this post:

    MySql.Data.Entity 6.10.7 isn't compatible with MySql.Data 8.0.11.

    Oracle renamed the package to MySql.Data.EntityFramework for v8.x. You need to uninstall MySql.Data.Entity and install MySql.Data.EntityFramework. Once I did this simple step, the data connection started working and the EDMX designer started working as well (although I have to go back to 2017 Visual Studio because the Designer Tools for VS 2019 were not available at the time of this post.)

    Hope this newer post helps some of you.

    I had the same problem using MySQL Connector 6.9.8.0. While all my versions matched, this still failed. I had installed a new version of Visual Studio AFTER the MySQL connector (From 2010 to 2013). For me, the solution was to uninstall the MySQL Connector for NET and then reinstall it (Exact same version). Then restart Visual Studio.

    Seems like this is another version of the same problem.

  • Add a new empty EF model.
  • In the emdx design rigth click and update the model from database.
  • choose your database and the model will be generate.
  • That's work for me :)

    doesn't work for me, neither does the solution below. The wizard comes up but then does nothing – djack109 Mar 27, 2018 at 20:41

    --->install the entityframework 6.2.0 via nuget.

    --->Verify in your web.config/app.config file that you have the System.Data.SqlServerCe.4.0 provider. if it's not installed, then install it via nuget, the exact same version as the entity framework previously installed (6.2.0 in this case).

    --->then add the references: (in this case from the connector/NET version 6.9.10) C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5\MySql.Data.dll and C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5\MySql.Data.Entity.EF6.dll and rebuild.

    --->try adding this provider too: <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> rebuild, again.

    --->and finally, try adding the .edmx file with a new connection.

    This worked in my case where i installed VS2017 and MySQL in a brand new laptop, and had the same issue.

    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.11.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"></provider>

    This did not work for my Visual Studio 2017 Community project that is experiencing the OP's issue. – Ray Goudie Oct 27, 2018 at 0:43

    Step 1

    Install MySQL Connector/NET version 6.8.4 on https://downloads.mysql.com/archives/c-net/

    Install MySQL for Visual Studio on https://dev.mysql.com/downloads/windows/visualstudio/

    Step 2

    Add Refenreces:

  • MySql.Data
  • MySql.Data.Entity.EF5
  • Step 3

    Add codes (at the below) to web.config

     <system.data>
        <DbProviderFactories>
          <remove invariant="MySql.Data.MySqlClient"></remove>
          <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.8.4.0, Culture=neutral" />
        </DbProviderFactories>
      </system.data>
            

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.

  •