9

I switch to Visual Studio 2019 and when I tried to install MySQL for VS in order to use Entity Framework, I didn't saw the 2019 version.

I used the following link : Link to MySQL Addon and Connector

Is there any way to get the MySQL functionality in VS2019 or am I doing something wrong?

Thanks,

and as proof of concept MySQL installer

Albert Alonso
  • 656
  • 1
  • 6
  • 21
  • This is a question for the MySQL developers. – Richard Apr 12 '19 at 06:47
  • 1
    Same problem here. Looks like there is no VS2019 support yet. I'm using VS2017. – Kamil Apr 12 '19 at 13:28
  • 2
    You can find help here: https://github.com/ErikEJ/EFCorePowerTools/issues/17#issuecomment-480792319 – ErikEJ Apr 12 '19 at 15:14
  • 4
    MySQL is always very slow at keeping up with visual studio releases. It happened with 2017 as well. Visual Studio has preview releases in order to get these major companies to start getting their products compatible with the new release, MySQL is like: "what is this useless thing, go away..." :) – Lenard Bartha Jun 12 '19 at 15:36

3 Answers3

11

After a lot of attempts, I've found this way to make vs2019 working with MySql and EF6, at least regarding "Database First".

1) Remove mysql for visualstudio

2) Remove mysql connector net

3) Install mysql for visualstudio 2.0.5

4) install mysql connector net 6.10.8

5) Create a new C# project using framework 4.5.2

6) Via Nuget, add Microsoft Entity Framework 6.2.0

7) Via Nuget, add MySql.Data.Entity 6.10.8

8) Open App.config. There are errors in the row:

<provider invariantName="MySql.Data.MySqlClient" ...

add the missing '/' at the end and delete '</provider>'

9) Build the solution

Now add a new ADO.Net Entity Data Model and you should be able to work with your mysql database

il Giovine
  • 166
  • 3
  • Install below package through console, related packages will automatically get installed. https://www.nuget.org/packages/MySql.Data.Entity/6.10.8 – Dileep Paul Aug 03 '19 at 08:39
  • 5
    I did so but when I tried to create EF model I just saw the screen with radio button Entity Framework 6.x and this screen closed immediately. Did you met this problem? – BambinoUA Nov 07 '19 at 16:19
  • Which MySQL version you are using ? – Moeez May 31 '20 at 15:17
  • @Faisal, I don't remember what I was doing. There were many dances with tambourine but finally my MCS became working except one thing - I cannot select objects as data sources. Below, cuts from my App.config. Hope it helps.
    – BambinoUA Jun 02 '20 at 10:48
  • I've solved following https://stackoverflow.com/questions/60386441/connect-entity-framework-with-mysql-in-vs2019 – marcogramy Oct 16 '20 at 12:54
2

It seems that Oracle hasn't provided official MySQL support for Visual Studio 2019 yet. You may have to wait for a new version and temporarily use Visual Studio 2017 instead.

Roger.K
  • 181
  • 1
  • 4
0

I found that the MySQL installer checks a set of registry keys to detect Visual Studio (and it only goes up to Visual Studio 2017).

Sample detection key: [HKEY_CLASSES_ROOT\VisualStudio.DTE.15.0]

I faked the Visual Studio 2017 key and the installation check succeeded, and on completing the installation the MySQL tools turned up in Visual Studio 2019.

My fake registry file is just an export of the Visual Studio 2019 key already in my registry - then I changed the version number to look like the Visual Studio 2017 key that the MySQL installer was looking for. Merging the edited registry file adds the fake Visual Studio 2017 keys into the registry and leaves the existing Visual Studio 2019 keys alone.

This gets me the MySQL toolbar, and the Add Data Connection functionality. I added EF6 and the Oracle MySql.Data.EntityFramework NuGet packages to a console app and the EF stuff worked.

Here are the registry file contents - I changed the exported DTE.16.0 values in my .reg file to DTE.15.0 (i.e. the old keys that MySQL was looking for) and left the text and GUID as they were for Visual Studio 2019:


REGEDIT4

[HKEY_CLASSES_ROOT\VisualStudio.DTE.15.0]
@="Microsoft Visual Studio DTE Object"

[HKEY_CLASSES_ROOT\VisualStudio.DTE.15.0\CLSID]
@="{2E1517DA-87BF-4443-984A-D2BF18F5A908}"

Make a .reg file and merge the contents then the installer will work. Your mileage may vary so maybe check it on a VM before trusting a random Internet stranger :-) ...

Nick
  • 138,499
  • 22
  • 57
  • 95
ColinPM
  • 11
  • 3