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:
- First install Visual Studio 2012, or VS 2013 or VS 2015
- Then, install MySQL for Visual Studio version 1.2.4 or earlier
- 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\“
(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\“
(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\“
(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\
(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\
(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\
(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:
function Test-RegistryValue { param( [Alias("PSPath")] [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [String]$Path , [Parameter(Position = 1, Mandatory = $true)] [String]$Name , [Switch]$PassThru ) process { if (Test-Path $Path) { $Key = Get-Item -LiteralPath $Path if ($Key.GetValue($Name, $null) -ne $null) { if ($PassThru) { Get-ItemProperty $Path $Name } else { $true } } else { $false } } else { $false } } } function ValidateRegistryAndExtensionsFile($vsVersion, $pluginRegistryPath, $pluginRegistryName, $vsRegistryPath, $vsRegistryName, $vsRegistryValue, $extensionsFilePath) { echo $("`n`n -- Check whether the M4VS plugin is installed for VS" + $vsVersion + ".") if (Test-RegistryValue -Path $pluginRegistryPath -Name $pluginRegistryName) { echo $("> The script detected that the M4VS plugin is installed for VS" + $vsVersion + ". Checking if registry key needs to be created.") if (!(Test-RegistryValue -Path $vsRegistryPath -Name $vsRegistryName)) { echo $("> The registry key doesn't exists for VS" + $vsVersion + ". The script will create it.") New-Item -Path $vsRegistryPath -Force New-ItemProperty -Path $vsRegistryPath -Name $vsRegistryName -Value $vsRegistryValue -PropertyType String -Force ### Write in the registry that we have created the registry key New-ItemProperty -Path "hkcu:\Console" -Name $("M4VSUninstall_RegKey_" + $vsVersion) -Value "1" -PropertyType String -Force echo $("-- Check whether the extensions file exists for VS" + $vsVersion + ".") if (!(Test-Path $extensionsFilePath)) { echo $("> The extensions file doesn't exists for VS" + $vsVersion + ". The script will create it.") New-Item $extensionsFilePath -type file -force ### Write in the registry that we have created the file New-ItemProperty -Path "hkcu:\Console" -Name $("M4VSUninstall_ExtFile_" + $vsVersion) -Value "1" -PropertyType String -Force } else { echo $("> The extensions file already exists for VS" + $vsVersion + ".") } } else { echo $("> The registry key for VS" + $vsVersion + " already exists.") } } else { echo $("> The script detected that the M4VS plugin is NOT installed for VS" + $vsVersion + ".") } } function Is64BitsOS() { $version = (Get-WMIObject win32_operatingsystem).OSArchitecture if ($version.Contains("64")) { return $true; } return $false; } $pluginRegistryPath = "hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders" ###### VS 2012 ###### $pluginRegistryName = if (!(Is64BitsOS)) {"C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Oracle\MySQL for Visual Studio\"} else {"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Oracle\MySQL for Visual Studio\"} $vsRegistryPath = if (!(Is64BitsOS)) {"HKLM:\Software\Microsoft\VisualStudio\11.0\Setup\VS"} else {"HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS"} $vsRegistryName = "EnvironmentDirectory" $vsRegistryValue = if (!(Is64BitsOS)) {"C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\"} else { "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\"} $extensionsFilePath = if (!(Is64BitsOS)) {"C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\extensions.configurationchanged"} else {"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\extensions.configurationchanged"} ValidateRegistryAndExtensionsFile -vsVersion "2012" ` -pluginRegistryPath $pluginRegistryPath ` -pluginRegistryName $pluginRegistryName ` -vsRegistryPath $vsRegistryPath ` -vsRegistryName $vsRegistryName ` -vsRegistryValue $vsRegistryValue ` -extensionsFilePath $extensionsFilePath ###### VS 2013 ###### $pluginRegistryName = if (!(Is64BitsOS)) {"C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Oracle\MySQL for Visual Studio\"} else {"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Oracle\MySQL for Visual Studio\"} $vsRegistryPath = if (!(Is64BitsOS)) {"HKLM:\Software\Microsoft\VisualStudio\12.0\"} else {"HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\12.0\"} $vsRegistryName = "ShellFolder" $vsRegistryValue = if (!(Is64BitsOS)) {"C:\Program Files\Microsoft Visual Studio 12.0\"} else { "C:\Program Files (x86)\Microsoft Visual Studio 12.0\"} $extensionsFilePath = if (!(Is64BitsOS)) {"C:\Program Files \Microsoft Visual Studio 12.0\Common7\IDE\Extensions\extensions.configurationchanged"} else {"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\extensions.configurationchanged"} ValidateRegistryAndExtensionsFile -vsVersion "2013" ` -pluginRegistryPath $pluginRegistryPath ` -pluginRegistryName $pluginRegistryName ` -vsRegistryPath $vsRegistryPath ` -vsRegistryName $vsRegistryName ` -vsRegistryValue $vsRegistryValue ` -extensionsFilePath $extensionsFilePath ###### VS 2015 ###### $pluginRegistryName = if (!(Is64BitsOS)) {"C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Oracle\MySQL for Visual Studio\"} else {"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Oracle\MySQL for Visual Studio\"} $vsRegistryPath = if (!(Is64BitsOS)) {"HKLM:\Software\Microsoft\VisualStudio\14.0\"} else {"HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\14.0\"} $vsRegistryName = "ShellFolder" $vsRegistryValue = if (!(Is64BitsOS)) {"C:\Program Files\Microsoft Visual Studio 14.0\"} else { "C:\Program Files (x86)\Microsoft Visual Studio 14.0\"} $extensionsFilePath = if (!(Is64BitsOS)) {"C:\Program Files \Microsoft Visual Studio 14.0\Common7\IDE\Extensions\extensions.configurationchanged"} else {"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\extensions.configurationchanged"} ValidateRegistryAndExtensionsFile -vsVersion "2015" ` -pluginRegistryPath $pluginRegistryPath ` -pluginRegistryName $pluginRegistryName ` -vsRegistryPath $vsRegistryPath ` -vsRegistryName $vsRegistryName ` -vsRegistryValue $vsRegistryValue ` -extensionsFilePath $extensionsFilePath
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:
function Test-RegistryValue { param( [Alias("PSPath")] [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [String]$Path , [Parameter(Position = 1, Mandatory = $true)] [String]$Name , [Switch]$PassThru ) process { if (Test-Path $Path) { $Key = Get-Item -LiteralPath $Path if ($Key.GetValue($Name, $null) -ne $null) { if ($PassThru) { Get-ItemProperty $Path $Name } else { $true } } else { $false } } else { $false } } } function DeleteRegistryAndExtensionsFile($vsVersion, $vsRegistryPath, $vsRegistryName, $extensionsFilePath) { ### Delete the created registry entry, if applies if (Test-RegistryValue -Path "hkcu:\Console" -Name $("M4VSUninstall_RegKey_" + $vsVersion)) { if ((Test-RegistryValue -Path $vsRegistryPath -Name $vsRegistryName)) { echo $("`n`n -- Deleting the VS registry path for VS" + $vsVersion + ".") Remove-ItemProperty -Path $vsRegistryPath -Name $vsRegistryName -Force } Remove-ItemProperty -Path "hkcu:\Console" -Name $("M4VSUninstall_RegKey_" + $vsVersion) -Force } ### Delete the created extensions file, if applies if (Test-RegistryValue -Path "hkcu:\Console" -Name $("M4VSUninstall_ExtFile_" + $vsVersion)) { if ((Test-Path $extensionsFilePath)) { echo $("`n`n -- Deleting the extensions file for VS" + $vsVersion + ".") Remove-Item $extensionsFilePath -force Remove-ItemProperty -Path "hkcu:\Console" -Name $("M4VSUninstall_ExtFile_" + $vsVersion) } } } function Is64BitsOS() { $version = (Get-WMIObject win32_operatingsystem).OSArchitecture if ($version.Contains("64")) { return $true; } return $false; } ###### VS 2012 ###### $vsRegistryPath = if (!(Is64BitsOS)) {"HKLM:\Software\Microsoft\VisualStudio\11.0\Setup\VS"} else {"HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS"} $vsRegistryName = "EnvironmentDirectory" $extensionsFilePath = if (!(Is64BitsOS)) {"C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\extensions.configurationchanged"} else {"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\extensions.configurationchanged"} DeleteRegistryAndExtensionsFile -vsVersion "2012" ` -vsRegistryPath $vsRegistryPath ` -vsRegistryName $vsRegistryName ` -extensionsFilePath $extensionsFilePath ###### VS 2013 ###### $vsRegistryPath = if (!(Is64BitsOS)) {"HKLM:\Software\Microsoft\VisualStudio\12.0\"} else {"HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\12.0\"} $vsRegistryName = "ShellFolder" $extensionsFilePath = if (!(Is64BitsOS)) {"C:\Program Files \Microsoft Visual Studio 12.0\Common7\IDE\Extensions\extensions.configurationchanged"} else {"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\extensions.configurationchanged"} DeleteRegistryAndExtensionsFile -vsVersion "2013" ` -vsRegistryPath $vsRegistryPath ` -vsRegistryName $vsRegistryName ` -extensionsFilePath $extensionsFilePath ###### VS 2015 ###### $vsRegistryPath = if (!(Is64BitsOS)) {"HKLM:\Software\Microsoft\VisualStudio\14.0\"} else {"HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\14.0\"} $vsRegistryName = "ShellFolder" $extensionsFilePath = if (!(Is64BitsOS)) {"C:\Program Files \Microsoft Visual Studio 14.0\Common7\IDE\Extensions\extensions.configurationchanged"} else {"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\extensions.configurationchanged"} DeleteRegistryAndExtensionsFile -vsVersion "2015" ` -vsRegistryPath $vsRegistryPath ` -vsRegistryName $vsRegistryName ` -extensionsFilePath $extensionsFilePath
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”)
cd c:\Temp
f) Execute the following command:
powershell.exe -ExecutionPolicy ByPass .\M4VSUninstall_Validation.ps1
g) Uninstall the MySQL for Visual Studio plugin.
h) Execute the following command:
powershell.exe -ExecutionPolicy ByPass .\M4VSUninstall_PostValidation.ps1
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.