无法卸载 MySql Connector .Net 6.9.3,在 MySql.Web 失败。v20.dll

Cannot Uninstall MySql Connector .Net 6.9.3, failure at MySql.Web.v20.dll

环境:Windows 7 和 8.1,均为 x64

我无法卸载 MySql Connector.Net 或安装更新。我查看了错误日志,此时出现故障

Uninstalling assembly 'C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.dll'.
Affected parameters are:
   logtoconsole = 
   logfile = C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.InstallLog
   assemblypath = C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.dll
An exception occurred during the uninstallation of the MySql.Web.Security.CustomInstaller installer.
System.NullReferenceException: Object reference not set to an instance of an object.
An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete.
Uninstalling assembly 'C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.dll'.
Affected parameters are:
   logtoconsole = 
   logfile = C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.InstallLog
   assemblypath = C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.dll
An exception occurred during the uninstallation of the MySql.Web.Security.CustomInstaller installer.
System.NullReferenceException: Object reference not set to an instance of an object.
An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete.

基本上,MySql.Web.v20.dll卸载失败。

Oracle 将此文件放在:

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\MySql.Web\v4.0_6.9.3.0__c5687fc88969c44d

此文件夹包含这些文件:

MySql.Web.dll
MySql.Web.dll.old
MySql.Web.v20.dll

我确实看到 post 使用包管理器,它可以将库安装到项目中。这是一种变通方法,但这并没有解决如何卸载 Oracle 的 MySql Connector .Net

的问题

关键一行是:

System.NullReferenceException: Object reference not set to an instance of an object.

这会告诉我安装程序试图找到一些东西但失败了。

对于所有好奇的人,使用 "mysql-connector-net-6.9.3.msi" 修复安装成功完成,然后使用 MSI 删除安装失败并出现相同的错误消息。

注意: 可以使用以下行获取详细日志:

C:\> C:\Users\Me\Downloads\mysql-connector-net-6.9.3.msi /lvx* C:\Users\Me\Downloads\mysql-connector-net-6.9.3-uninstall.log

该文件在以下位置发生故障:

MSI (s) (3C:AC) [15:24:20:167]: Executing op: CustomActionSchedule(Action=ManagedWebUnInstall,ActionType=3073,Source=BinaryData,Target=CAQuietExec,CustomActionData="C:\Windows\Microsoft.NET\Framework\v4.0.30319\installUtil.exe" /LogToConsole=false /LogFile= /u "C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.dll")

对于所有没有旧 MSI 副本并希望获得重命名的原始副本的用户,您可以在类似于注册表中的路径中找到它:

Computer\HKLM\SOFTWARE\Microsoft\Windows\currentVersion\Installer\userData\S-1-5-18\Products[=18=]B758472CF889E4383C13AC77DFAD59\InstallProperties

我发现几篇文章讨论了 运行 从命令提示符的管理员启动卸载的解决方案。没有骰子!

我做到了,在第一次执行修复操作(通过管理员命令提示符)后执行特定的卸载命令。

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\installUtil.exe" /LogToConsole=true /u "C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.dll"

输出是: 卸载开始。 查看 C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.dll 程序集的日志文件的内容。 该文件位于 C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.InstallLog。 正在卸载程序集 'C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.dll'。 受影响的参数是: logtoconsole = 真 logfile = C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.InstallLog assemblypath = C:\Program Files (x86)\Development\Database\MySQL\MySQL Connector Net 6.9.3\Assemblies\v2.0\MySql.Web.v20.dll 卸载 MySql.Web.Security.CustomInstaller 安装程序期间发生异常。 System.NullReferenceException: 对象引用未设置为对象的实例。 卸载时出现异常。此异常将被忽略,卸载将继续。但是,卸载完成后可能无法完全卸载应用程序。

The uninstall has completed.
An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete.

基本上,问题出在自定义安装程序的卸载上。

我在 Oracle's site, which mentions possibly a link to the machine.config file and that mentioned something interesting, see this response 上找到了一篇文章。这是复制粘贴。

I went deeper and analyzed MySql.Web.Security.CustomInstaller.RemoveProfileProvider from connector C# code. Following code is not properly checked: 

XmlNodeList nodes = doc.GetElementsByTagName ("profile"); 
XmlNode providersNode = nodes [0].FirstChild; 
foreach (XmlNode node in providersNode.ChildNodes) 
{ 
string name = node.Attributes ["name"].Value; 
if (name == "MySQLProfileProvider") 
{ 

This code expects every XML node below machine.config's <system.web\profile\providers> to have "name" attribute. Otherwise it crashes. It was happening to me, cause I had <clear /> node there (which doesn't make much sense in machine.config, but is valid). 

In general .NET Connector installer is very sensitive of machine.config files, which comes from MySql.Web.Security.CustomInstaller class.

显然,这个问题可以追溯到几年前,而且是间歇性的。 Oracle/MySQL 团队没有做任何事情来解决这个问题,我是可怜的人,运行 在两台机器上遇到这个问题。

其他链接:

Posting on Oracle w/solution

Less useful response on MSDN

为了子孙后代或任何其他可能有一天 运行 遇到这个问题的人,这里是修复:

问题是两台本地计算机上的 machine.config 文件。该文件没有正确的条目或使安装程序感到困惑的任何内容。

我比较了一台机器上的 machine.config 文件,在那里我可以 install/uninstall 到故障机器并设置与 MySql 不同的行,然后继续再次尝试卸载(或 install/uninstall on W81)。成功!

这个问题真是把我搞糊涂了。安装程序不应该对该文件如此敏感。错误消息有点错误,因为失败不是 DLL,而是 machine.config.