MySQL for Visual Studio – Uninstall workaround

In MySQL for Visual Studio version 1.2.4 and earlier, there was an issue, existing only under a specific scenario, which was preventing the plugin to be uninstalled (either using the “Remove” option in the Windows Control Panel/Programs, or the MySQL Installer for Windows) or upgraded to a newer version, causing the uninstall/update action to be rolled back during the process. (For further information about this issue please refer to http://bugs.mysql.com/bug.php?id=71226).

Such scenario can be achieved as follows:

  1. First install Visual Studio 2012, or VS 2013 or VS 2015
  2. Then, install MySQL for Visual Studio version 1.2.4 or earlier
  3. Later, uninstall Visual Studio 2012, or VS2013 or VS2015

With the scenario described above, the uninstall/upgrade process of the MySQL for Visual Studio plugin is aborted, leaving it installed on the computer.

It is important to mention that this issue was already fixed in MySQL for Visual Studio 1.2.5 or later, so we encourage you to download and install the latest version available. You can choose to upgrade via the MySQL Installer for Windows, or running the MySQL for Visual Studio standalone installer that you can download here: http://dev.mysql.com/downloads/windows/visualstudio.

Anyway, if you only want to uninstall the MySQL for Visual Studio plugin, and have the scenario described above, you can follow the next steps:

1. Manually create the missing registry values and files needed for the uninstall process of the MySQL for Visual Studio plugin:

a) Create (if not exists) the following registry hive:

* If you had VS 2012 when the MySQL for Visual Studio plugin was installed:

– For 32-bit OS:

HKLM:\Software\Microsoft\VisualStudio\11.0\Setup\VS

Having the key “EnvironmentDirectory” with the value “C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\

– For 64-bit OS:

HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS

Having the key “EnvironmentDirectory” with the value “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\

vsRegistryPath_VS2012

(Figure 1: Registry key needed for Visual Studio 2012)

* If you had VS 2013 when the MySQL for Visual Studio plugin was installed:

– For 32-bit OS:

HKLM:\Software\Microsoft\VisualStudio\12.0

Having the key “ShellFolder” with the value “C:\Program Files\Microsoft Visual Studio 12.0\

– For 64-bit OS

HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\12.0

Having the key “ShellFolder” with the value “C:\Program Files (x86)\Microsoft Visual Studio 12.0\

vsRegistryPath_VS2013

(Figure 2: Registry key needed for Visual Studio 2013)

* If you had VS 2015 when the MySQL for Visual Studio plugin was installed:

– For 32-bit OS:

HKLM:\Software\Microsoft\VisualStudio\14.0

Having the key “ShellFolder” with the value “C:\Program Files\Microsoft Visual Studio 14.0\

– For 64-bit OS

HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\14.0

Having the key “ShellFolder” with the value “C:\Program Files (x86)\Microsoft Visual Studio 14.0\

vsRegistryPath_VS2015

(Figure 3: Registry key needed for Visual Studio 2015)

b) Create (if not exists) an empty file named “extensions.configurationchanged“, in the following path:

* If you had VS 2012 when the MySQL for Visual Studio plugin was installed:

– For 32-bit OS:

C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\

– For 64-bit OS

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\

extensionsFilePath_VS2012

(Figure 4: File needed for Visual Studio 2012)

* If you had VS 2013 when the MySQL for Visual Studio plugin was installed:

– For 32-bit OS:

C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\

– For 64-bit OS

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\

extensionsFilePath_VS2013

(Figure 5: File needed for Visual Studio 2013)

* If you had VS 2015 when the MySQL for Visual Studio plugin was installed:

– For 32-bit OS:

C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\

– For 64-bit OS

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\

extensionsFilePath_VS2015

(Figure 6: File needed for Visual Studio 2015)

c) Proceed to uninstall the MySQL for Visual Studio plugin, using the “Remove” option in the Windows Control Panel/Programs, or executing the plugin installer (version 1.2.4 or earlier).

2. Create and execute two PowerShell scripts to automate the process mentioned in step 1, performing the next operations:

a) Using a text editor, create a new text file

b) Copy the following script into the file:

Note: This script is provided as a convenience to you as-is, without any express or implied warranties of any kind. Its intention is to automate the process of create the registry values and files needed by the MySQL for Visual Studio plugin uninstall process.  Oracle is not liable for any issues arising out of your use of the script.

c) Save the file as “M4VSUninstall_Validation.ps1”. Verify the file extension is “.ps1” (selecting the option “All Files” from the drop-down list in the “Save as type” option), so the same is not saved as text, but as a valid PowerShell file. Save it to a valid path, like “C:\Temp”.

d) Following the same steps explained above, create a second “.ps1” file, with the following script:

Note: This script is provided as a convenience to you as-is, without any express or implied warranties of any kind. Its intention is to automate the cleanup operations once the registry values and files needed by the MySQL for Visual Studio plugin uninstall process has been created.  Oracle is not liable for any issues arising out of your use of the script.

Save the file as “M4VSUninstall_PostValidation.ps1” in the same path, validating it is saved as a PowerShell file.

e) Open a PowerShell command window, and go to the path where you saved the scripts (like “C:\Temp”)

f) Execute the following command:

g) Uninstall the MySQL for Visual Studio plugin.

h) Execute the following command:

in order to cleanup any registry/files created by the scripts, and needed by the uninstall process.

With this workaround, you should be able to uninstall MySQL for Visual Studio 1.2.4 and earlier.

Thank you all for your support, and keep enjoying MySQL for Visual Studio.