Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Data Source Not Showing Up In Visual Studio 2015

As the title says, no matter what I do MySQL does not appear in the list of Data Sources in Visual Studio 2015.

I have done everything that is suggested in this question: MySQL Data Source not appearing in Visual Studio

I have also installed development releases and different versions of connectors with the corresponding MySQL VS drivers as per this table here: https://dev.mysql.com/doc/visual-studio/en/visual-studio-install.html

I have reinstalled Visual Studio itself.

All of this to no avail. I can manually configure the connection and run a .Net application that reads from and writes to MySQL but Visual Studio refuses to do anything with MySQL in the data source popup window.

Short of moving the database to SQL Server I am not sure what else can be done here.

Any suggestion or help to get this resolved would be great. I've been at this for the last 48 hours.

Currently installed versions: MySQL for Visual Studio - 1.2.7, Connector/Net - 6.9.9

This is for a .Net 4.5.2 based project.

like image 628
Nico Avatar asked Aug 20 '17 18:08

Nico


People also ask

How do I view datasource in Visual Studio?

In Solution Explorer (on the right of the Microsoft Visual Studio window), right-click Data Source Views, and then click New Data Source View. On the Welcome to the Data Source View Wizard page, click Next. The Select a Data Source page appears.

How do I add a data source window in Visual Studio?

Open your project in Visual Studio, and then choose Project > Add New Data Source to start the Data Source Configuration Wizard. Choose the type of data source to which you'll be connecting. Choose DataSet from the list of options. Choose the database or databases that will be the data source for your dataset.

How do I get MySQL code for Visual Studio?

Step 1: Open Visual Studio Code. Step 3: Open the extension called MySQL Management Tool and install it. Step 4: Now click on the Explorer option or press ( Ctrl + Shift + E ), MySQL is added to this section. Step 5: Click on Add Connection to create a new connection.


1 Answers

I have had this same problem a while back. Unfortunately I think the answer is case by case, and I can't remember what exactly fixed it other than playing around with versions of MySQL Server and MySQL Connector/Net versions.

I have VS 2015 so I just tried to recreate this problem. I was unable to do so as I installed MySQL for VS 1.2.7 and Connector/Net 6.9.9 and was able to see MySQL Database as an option in the Data Sources window.

I recommend uninstalling both MySQL for VS and your Connector/Net 6.9.9 and then reinstalling them. Make sure you install MySQL for VS before Connector/Net as the documenation you linked in your question says "Always install MySQL for Visual Studio before installing MySQL Connector/Net."

You might also try using MySQL community server instead of MySQL for VS and using an older version of Connector/Net.

Update

Try doing the following:

  1. Uninstall MySQL for VS and Connector/Net.
  2. Install Connector/Net 6.9.9 by doing a custom installation. Remove the Web providers feature from the installation and continue with installation.
  3. Install MySQL for VS 1.2.7 by doing a custom installation. Make sure that the Visual Studio Integration feature is selected for installation and finish installation (It should be selected by default).

Update 2

If you want more alternatives to reinstalling:

Try checking out your machine.config file properties to see if the MySQL Data Provider property is similar to mine by going to C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG

Lines to check:

  • ltsadd name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=XXXXXXXXX" /gts

Also, maybe try a creating a website instead of a project or vice versa. There are multiple ways to get to the Data Source window. You could try creating an ADO.Net object and adding a connection to see if that data source window displays MySQL as a data source. You can also create a connection through the server explorer window. Just follow these steps.

like image 184
Kyle Scott Avatar answered Oct 01 '22 07:10

Kyle Scott