13

As you can see i've already installed the necessary mysql packages such as Mysql for Visual studio and Connector/NET but no matter what the mysql is not appearing in Visual studio 2017 Data source menu, any suggestion ? : enter image description here

enter image description here

kkafkas
  • 322
  • 1
  • 3
  • 13

3 Answers3

22

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.

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

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

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

Note: Until this step, you should be covered, but you'll then encounter Entity Framework issues, follow the next steps to completely configure your environment and you should be good to go.

  1. Create new Visual Studio Professional 2017 project.

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

  3. Add references to C:\Program Files (x86)\MySQL\Connector.NET 6.9.10\Assemblies\v4.5\MySql.Data.dll and 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.

  4. 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>
  1. 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:

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

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

Hadi
  • 36,233
  • 13
  • 65
  • 124
Alfredo Rodriguez
  • 1,223
  • 1
  • 13
  • 12
  • Please don't post link only answers to other Stack Exchange questions. Instead, include the essential portions of the answer here, and *tailor the answer to this specific question.* – Machavity Nov 26 '17 at 16:53
  • 1
    I followed the exact same steps as above, but it didn't worked for me. – Aditya Pewekar Nov 27 '17 at 17:58
  • 1
    You saved my day. I got a headache trying to generate contect for MySQL database. Thanks. P.S. What is important to follow step by step. Also it's needed to add references directly from the installed folder. With nuget packages it doesn't work for some reason. – mykhailovskyi Mar 18 '18 at 15:23
  • well done this works for me after messing around for two days - I think it was that version 2.0.5 with 6.9.12. Everything else was giving me errors on retrieving schema when using the sqldatasource – AShah Oct 07 '18 at 21:16
3

The native MySQL .net connector does not yet support Visual Studio 2017. It was mentioned in the MySQL forums that they expect around a 3 month wait before an updated connector is expected to be ready in the meantime Devart has a connector that works with MySQL and is compatible with VS2017.

Edit

Native MySQL for Visual Studio 2017 support is available. More info at: https://dev.mysql.com/doc/visual-studio/en/visual-studio-install.html

Dave B
  • 659
  • 8
  • 29
  • 1
    This did not work for me! Bitdefender report there is a virus in Devart connector. Native support does not enable MySQL data provider either – Jalle Oct 05 '17 at 10:45
  • 1
    I can't speak about Devart Connector, but if you use [MySQL 6.9.8](https://downloads.mysql.com/archives/c-net/) it will work with Visual Studio 2017. – Dave B Oct 05 '17 at 11:03
  • @DaveB that version isn't alive anymore, from the ones listed there do you know which one might work? I tried the latest one and is not showing on my Data Source window ..... not sure if I am missing something – ReynierPM May 06 '19 at 19:15
  • 1
    @reynierpm version 6.9.8 is still available in the archive download section. A Google search will give you the link. I still use that version in my solution. – Dave B May 06 '19 at 20:03
2

My circumstance is a bit different: during the first time I installed it, the option is there but the next day it's missing.

I tried uninstalling then installing Mysql for Visual studio and Connector/NET before restarting my laptop but it still didn't appear until I went to Tools > Extensions and Updates... in the main menu. A pop-up Extensions and Updates will appear and under Installed, find MySQL for Visual Studio and enable it. After closing Visual Studio, the option came back after starting Visual Studio again.

(I hypothesise VS disabled it because it made running slower. I'm using Visual Studio 2017 btw)