【发布时间】:2015-05-03 01:37:32
【问题描述】:
环境: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
我确实看到了使用包管理器的帖子,它可以将库安装到项目中。这是一种解决方法,但这并不能解决如何卸载 Oracle 的 MySql 连接器 .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\00B758472CF889E4383C13AC77DFAD59\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”。 受影响的参数是: 登录控制台 = 真 日志文件 = 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 卸载 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 上找到了一篇文章,其中可能提到了 machine.config 文件的链接,并且提到了一些有趣的事情,请参阅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 团队没有做任何事情来解决这个问题,而我是可怜的灵魂,在两台机器上都遇到了这个问题。
其他链接:
【问题讨论】:
标签: mysql .net windows mysql-connector