如何确定导致 Windows Installer 重复自我修复的原因?

发布于 2024-10-29 20:59:11 字数 156 浏览 0 评论 0 原文

  • 如何仅记录导致 Installshield 2008 所做的 MSI 文件通过“自我修复”重新安装的更改?
  • 自修复的原因是什么?
  • 如何使用 Installshield 2008 禁用 MSI 自我修复?
  • How can I log only the changes causing a MSI file made by Installshield 2008 to reinstall via "self-repair"?
  • What is the reason behind self-repair?
  • How do I disable self-repairing of MSI using Installshield 2008?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沙与沫 2024-11-05 20:59:11

自我修复,简单易用简短说明为什么如果我删除文件,MSI 安装程序会重新配置?


可用的替代答案

更新
有一个更短、更“以解决方案为中心”的答案,也许可以先尝试一下。这个答案的重点是“理解自我修复”,而不是解释消除问题所采取的步骤。您可能还想阅读此答案的第一部分。


意外的 Windows Installer 自我修复问题 - 快速修复?

这篇“文章”已经变得很大并且有些难以阅读。这是一个新写的序言 - 简短的“解决方法版本”,用于修复意外的自我修复(通常在 VB6、Visual Studio、MS Office、MS Outlook、AutoCAD 等中找到)

  • 如果您体验意外的自我修复您可以尝试的第一件事是直接手动创建桌面快捷方式到您在启动时启动的应用程序可执行文件出现问题。这绕过了最常见的自我修复触发因素,即“广告快捷方式”。如果这有效,您的问题就“解决”(或避免)。 这是一个快速、充实的-out 说明
  • 如果问题仍然存在,或者您的问题与加载 MS OfficeMS Outlook 加载项 或类似内容(您无法通过快捷方式启动),那么您的系统上很可能存在 COM 注册冲突,并且修复起来要复杂得多。 最简单的尝试是在相关应用程序的插件对话框中禁用任何不需要的插件,看看这是否可以解决问题,
  • 如果您仍然看到问题,那么您通常需要调试真正的 COM 注册冲突(或冲突的文件/MIME 关联或命令动词)。这通常涉及(至少)系统上两个冲突的应用程序,它们在每次启动时在另一个应用程序运行后更新注册表(始终启动其中一个应用程序不会触发自我修复 - 当冲突出现时)您可以在应用程序之间交替)。也有可能是权限问题导致同一个应用程序无法更新系统,通过反复运行自我修复不断尝试。还有更多的可能性,更多细节如下
    • 真正的解决办法”是联系两个应用程序供应商要求他们修复问题(因为修复通常需要两个供应商 MSI 的修复),但根据我的经验,这很少成功。不过,请尝试一下 - 因为这是帮助每个人解决长期烦恼的方法!我亲自提供了一个包含银行部署修复的设置,并且很高兴在我的包中解决了问题
    • 要自行调试,您需要找到一个工具来打开系统上缓存的 MSI 文件,并且需要“破解”数据库 - 这是一项非常复杂的任务需要专业技能,您需要如果您的桌面环境问题非常严重,建议您寻求安装专家的帮助。它可以起作用,但不要指望奇迹。
    • 请参阅下面的“查找自我修复的触发因素或罪魁祸首”部分,了解有关获取查看和修改 MSI 文件的工具的更多详细信息

“文章”的其余部分描述了自我修复问题深入。除了这个“简短”部分中描述的原因之外,还有许多其他潜在的自我修复原因。


总体问题:开发者调试和自我修复

Windows Installer是一种部署技术,它的工作是安装指定的文件和注册表设置并将它们保存在指定的安装位置,并确保它们是正确的版本 - 自我修复或弹性是达到此目的的一种机制。它的操作与开发人员需要动态交换文件以进行调试、开发和测试相冲突。

因此,许多自我修复(弹性)只是由开发人员试图动态调试已安装的应用程序和热交换文件。有关如何处理此问题,请参阅下面的“一些典型的自我修复问题场景”中的第 2 节。在其他情况下,MSI 中存在必须纠正的真正的设计错误,或者存在导致自我修复的系统管理陷阱 - 有时错误源可能很难确定寻找。

我在serverfault.com 上的答案中写了有关自我修复的问题。对于系统管理员来说,用词略有不同,现在阅读它可能比这个冗长的解释(针对开发人员)更容易理解。 stackoverflow 上还有另一个更短的答案:为什么如果我删除文件,MSI 安装程序会重新配置?(这可能是最短且最容易理解的)。最后我发现了 Vadim Rapp 写的一篇关于自我修复的非常好的文章:如何修复 Windows Installer 自我修复。这篇文章非常值得一读。

如果 Windows Installer 确定正在启动的产品已正确安装,则不会进行自我修复。当发生自我修复时,需要对系统进行某些更改才能使应用程序正常运行。


自我修复的主要原因

详细信息如下一些典型的自我修复问题场景”部分,但作为一个快速的预示列表< /strong> - 主要原因是:

1。企业 MSI 文件打包不当或供应商的 MSI 设计缺陷(MSI 包本身设计不当,会因各种原因意外触发自我修复)

  • 每用户文件的过度或错误使用每用户注册表项通常在用户配置文件中设置了错误的密钥路径(而不是 HKCU)。有关更多详细信息,请参阅下面第 5 节(以及此类情况的彩色插图)
  • 错误的 COM 服务器注册(特别是VB6 COM 文件VBA 文件和来自 Autodesk 的 AutoCAD 等产品的库以及类似产品)。
    • 两个 MSI 软件包从两个不同位置注册相同的 COM 文件 (ActiveX/OCX),并在每次应用程序启动时进行“自我修复战斗”,以保持其版本正确注册。
    • 最后一个启动的应用程序会为自己设置正确的注册表,并且它会一直持续到另一个应用程序启动并执行相同操作为止。一旦您在应用程序之间切换,就会出现问题。有关 VB / COM 自我修复的更多详细信息,请参阅下面的第 7 节
  • 组件密钥路径设置为 Windows 安装程序在自修复时删除的空文件夹(触发删除和后续自我修复的无限循环)
  • ACL锁定权限问题(登录用户无法访问密钥文件并且Windows Installer重复触发修复)。这也可能是由外部完成的 ACL 更改引起的,但通常是由 MSI 本身完成的
  • 这是 serverfault.com 正在进行的工作,描述了常见的 MSI 设计缺陷

2.文件或注册表项会因外部原因的干扰而被删除,这些外部原因包括(登录)脚本、标准操作系统功能、病毒、安全软件等...

  • 临时文件自动删除 被 MSI 包错误安装到临时文件夹后被 Windows
  • 干扰,来自不良登录并触发愉快的清理脚本清理应用程序 strong>
  • 防病毒应用程序阻止或删除文件或注册表项,以便 Windows Installer 无法再检测或访问它们
  • 计算机病毒更改或删除文件和注册表设置
  • 过度活跃的计算机修补者和用户删除他们不理解的文件和设置

3. Windows 设计更改、缺陷或限制导致部署有缺陷或有问题


关于自我修复

Windows安装程序旨在安装应用程序的二进制文件、设置和数据文件,并保持它们的安装状态并确保它们是正确的版本。自我修复是达到此目的的一种机制。总体概念称为弹性 - 即损坏的安装会在应用程序启动之前触发自我修复。

弹性或自我修复,是Windows Installer 的内置主要概念并且无法关闭 以任何安全的方式。人们有时会做出最不可思议的事情,例如禁用整个 Windows Installer 引擎来停止自我修复。显然绝对不能这样做。必须确定修复原因并解决问题,而不是制造新问题或破解系统。

每次启动广告快捷方式(本质上是指向 Windows Installer 功能而不是直接指向文件的特殊快捷方式),Windows安装程序将通过检查产品的“组件密钥路径”来验证安装。如果发现差异,则会触发修复以纠正不完整的安装。 “组件密钥路径”是为 MSI 内的组件指定的“密钥文件” - 每个组件都有一个。自我修复也可以通过实例化 COM 服务器(或尝试)、通过文件扩展名或 MIME 注册激活文件以及其他一些方式来启动。以下是赛门铁克关于“自我修复入口点”主题的综合文章:使用入口点启动自我修复和广告功能

如果文件被删除、移动或简单地覆盖(由用户手动或以某种方式自动),则可能会导致自我修复(如果文件或注册表设置未设置为关键路径,则不会触发自我修复)。


查找自我修复的触发器或罪魁祸首

自我修复的触发器通常可以在发生自我修复的系统上的事件查看器中找到。按照以下步骤打开事件查看器

  • 右键单击​​“我的电脑”
  • 单击“管理”
  • 如果出现 UAC 提示,则单击“继续”
  • 转至“事件查看器”部分,然后检查 Windows 日志

或者,您也可以执行以下操作:<强>开始 => 运行... => eventvwr.exe 仅用于事件查看器。如果在开始菜单中没有看到“运行”,请按 WINKEY + R

在此处输入图像描述

  • 查看事件日志的“应用程序部分”,您应该会找到来自 ID 为 1001 和 1004 的事件源“MsiInstaller”的警告
  • 在上面的示例屏幕截图中,产品代码显示在红色框中。
  • 为了确定产品代码适用于什么产品,您可以< strong>通过此处说明的过程查找产品名称:如何找到已安装的 MSI 设置的产品 G​​UID?
  • 如果您确实想深入了解并检查实际内容要查看 MSI 文件,您必须找到能够查看 MSI 文件的工具 (例如 Orca、Installshield、高级安装程序或类似)。然后,打开“LocalPackage”路径列表中列出的包,如上一个要点中链接的答案中找到的屏幕截图所示。
  • 实际修改系统缓存的 MSI 文件和/或注册表以删除通告的入口点,例如(通告的)快捷方式、COM 注册、文件关联、MIME 关联或命令动词是一项专家的工作。这是非常复杂的并且不是好的做法,但这是我所知道的唯一的“最后手段”。
  • 最后,应用程序可以显式调用 Windows Installer 本身来触发共享组件的自我修复 - 例如拼写检查器。我相信 Microsoft Access 的几个版本都这样做了,而且据我所知,这种行为无法更改或解决。

MSI 专家MVP Stefan Krüger 有一篇文章关于同样的自我修复问题。他关键性地讨论了实际的事件日志条目及其含义。 请阅读那里的实际调试过程


一些典型的自修复问题场景:

这是对上面概述中已经概述的几种自修复问题场景的“详细解释”。

  1. 组件关键路径设置为空文件夹,Windows 安装程序会在自我修复时删除该文件夹(触发删除和后续自我修复的无限循环)。通过将该文件夹添加到 可以解决此问题CreateFolder 表 改为(Wix 等效)。根据我的经验,这是不必要的自我修复的最常见情况。 非常常见
  2. 许多自我修复问题实际上是由开发人员试图通过动态替换文件、删除文件或重命名来调试应用程序引起的。或者他们可以使用清理注册表脚本和/或批处理脚本来注销和注册 COM 文件、COM-Interop、GAC 文件、文件关联或其他常见的开发人员调试和开发任务。

    • 当通过广告快捷方式启动应用程序时,此热插拔可以触发自我修复。

    • 开发人员在应用程序调试期间遇到自我修复困难的重要提示是不要公布的快捷方式启动应用程序,而是直接从 Windows 资源管理器或手动创建的快捷方式启动主 EXE。这将绕过最常见的“自我修复入口点” - 广告快捷方式。自我修复仍可能由损坏的 COM 数据、广告文件关联和其他一些特殊情况导致 (阅读这篇赛门铁克文章以获取入口点信息)。


  3. 其他应用程序或更确切地说其他 MSI 软件包可能会破坏您的安装并通过干扰注册表数据(通常是 COM 设置,但也可能与其他设置和文件)进行自我修复。这些可能是最难解决的情况,因为应用程序基本上都在战斗,最后运行的每次都会更新注册表。通常,必须重新设计两个 MSI 文件才能使应用程序在同一台计算机上运行。或者,按照惯例,整个应用程序可以被虚拟化(例如:Microsoft App- V 虚拟包)并在自己的沙箱中运行,这似乎是当今公司越来越多的做法。这种错误情况经常出现在企业环境中重新打包不当的应用程序套件中。来自不同包的 COM 片段会覆盖来自另一个包的 COM 服务器的磁盘路径,并且在通过广告快捷方式启动每个应用程序时会发生自我修复战斗。具有不同文件版本的相同文件名也可以从不同的文件位置注册并共享一些干扰的注册表设置。据我所知,文件系统和注册表中至少有 7 个变量或设置必须同步,COM 服务器才能正确实例化。有关 VB6VBA COM 应用程序上下文中 COM 干扰的更专业描述,请参阅下面的第 7 节

  4. 组件键路径指向一个临时文件,该文件已被应用程序删除,或者最终将被系统通过某种清理机制(也可以是清理工具,例如作为清洁剂)。这对于临时文件夹本身中的文件来说很常见。通过不安装临时文件或将该文件放在其他位置并使其永久化可以解决此问题。我在企业应用程序重新打包领域最常看到此错误,其中捕获的图像的错误清理导致安装根本不应该包含在包中的临时文件。通常,它们可能是临时文件,等待重新启动以将其安装到预期的(可能是受保护的位置),并且从未执行重新启动 - 这是常见的应用程序打包错误。在较小程度上,我在自动构建系统的自动生成的包中看到了它。

  5. 权限问题:如果组件的密钥文件安装到调用应用程序的用户无法访问的位置。 Windows Installer 可能无法“看到”已安装的文件/密钥路径,或者无法将文件添加到文件夹。这些问题可能难以调试,并且可能不会经常发生。此问题有多种变体:

    • 例如,当您将文件安装到%USERPROFILE% 路径时,然后忘记设置 HKCU 注册表密钥路径,而是将密钥路径设置为指向 %USERPROFILE% 文件夹/文件。这通常会产生无法访问的特定于用户的硬编码密钥路径:C:\Documents and settings\user1\Desktop。其他用户登录将找不到该路径,自我修复循环往复。这是彩色插图
    • 另一个示例是将关键路径设置为系统帐户不可写的文件夹。这似乎是异国情调的,但可能是由于MSI对系统ACL条目的错误修改,奇怪的系统管理员安全设置或任何其他非标准ACL /安全描述符的修改。< / li>
  6. 终端服务器有关的另一类自我修复问题 citrix 。整个 Windows Installer Service 都可以锁定,以便为每个用户数据添加的任何自我修复都可能失败,因此自我修复可能会失败或更可能无法运行。这是足够的原因,不依赖自我修复作为添加像某些MSI文件一样添加用户数据的一种方式,并且必须将此类构造替换为从每电机位置复制的用户文件的应用程序部署或较小有效的 < < a href =“ https://stackoverflow.com/questions/1423687/1423687/updating-every-profiles-registriles-registry-registry-on-windows-server-2003/1424819”> activeVeveEtup 每个用户。

  7. vb6应用 vba应用程序基于com的 具有 com Interference 的巨大潜力(com)众所周知,设置相互覆盖并变得不一致),引发了一些神秘的自我修复问题,其中大多数尚未得到正确的解释。这也可能发生在Visual Basic 6(VB6)或Visual Studio(以及许多其他应用程序)的启动中。共同点是,当前安装状态中的某些错误触发了自我修复,您可以通过按照上面概述的步骤来追踪罪魁祸首和组件,称为“ 查找”自我修复的触发器或罪魁祸首”。 一定要在此处报告您的发现(我再也不会使用VB6或VBA-您的详细发现可以帮助他人长期以来的烦恼)。

    • 尽管我从未详细讨论过这样的VB6问题,但似乎是由安装 Common Controls vb6 com文件的应用程序引起的,模板 vba文件和库 与现有文件和注册表设置以及框上的注册相冲突,或者可能需要添加某些每用户注册表密钥或用户fofile文件(每个用户一次)(让自我修复完成一次,看看问题是否消失)。特别是我在启动 autocad (来自Autodesk)时听说过这些神秘的自我修复问题和其他几种产品(通常具有工具中的VBA自动化)。
    • 某些应用程序甚至会错误地将VB6运行时的零件和零件安装,从而在卸载这些应用程序的卸载上“将这些设置”“撕开”。这肯定会导致触发自我修复以修复现在的(部分?)损坏的VB6运行时。这个问题有几种变体,“所有捕获”解决方案可能是完整的卸载和重新安装VB6运行时。 这是对涉及几个涉及几个com commentistry的问题的描述键 。它很好地说明了这种情况下会发生什么。
    • 如果您在启动 vb6 autocad Visual Studio 或其他产品时会遇到意外的自我修复,则可以首先尝试解决方案,以防止这些意外的自我重复开始发生(这不能解决问题,但可能会绕过症状): 为什么Windows安装程序每次启动我启动Visual Basical 6 < /a>

    • 请参阅我对本主题中最典型的VB6风格自我重新训练之一的评论: 为什么我的应用程序触发了另一个应用程序的安装程序? (ActiveX Controt从磁盘上的两个不同位置进行了两次注册)。
    • 我认为,对于VB -COM自我修复问题,“ 总修复”应该始终可行可用正确安装和共享ActiveX Control / OCX,而不是依赖其自己的版本,并在错误的位置进行了注册。
  8. Windows安装程序维修或自我修复的一种特殊情况值得一提,是Microsoft Office几年前的自我修复将被触发的问题,您将是要求插入Microsoft Office安装媒体(当时CD -ROM或DVD-今天也许是Thumb Drives)。据我所记得的,这与对内置Windows安装程序标准操作“ esolvesourvesource ”的错误调用有关,该呼叫意外(并且不必要)触发了安装媒体的提示。 非常常见的支持呼叫回到当天,此处提到了完整性。重要的是要注意,每当从任何可移动媒体中安装MS Office 时,此问题仍然可以发生(而不是网络共享的更好选择)。当MS Office检测到需要进一步安装的产品最初未安装的产品组件(通常共享)组件时,就会发生这种情况。例如,不寻常的拼写检查器,各种模板或特定且较少使用的工具。可以安装这些组件以“首次使用”(广告功能是适当的Windows Installer术语)。

  9. 还有许多其他可能的情况。提到一些:

    • a 不良登录脚本可能会在系统上删除事物并触发自我修复
    • 广告包可能会失败无法安装并保持烦恼的人
    • 两个应用程序可以启动为同一文件关联而战
    • 计算机修补匠和黑客可以手动删除触发自我修复的数据
    • 防病毒可以隔离文件和注册表设置触发维修的
    • 病毒可以改变或删除事物并触发自我修复
    • a 磁盘和注册表清理工具(例如ccleaner)可以删除文件并触发自我修复
    • 毫无疑问,其他许多情况...

自我修复的良性用途

最终有一次良性用途发生一次,并且不构成错误。这是法律和适当使用自我修复,尽管它可能与设计错误一样令人讨厌,并且通过用户干预,他们可以一次又一次地弹出:

  • 自我修复有时用于将每个用户数据添加到 hkcu 用户配置文件。这种设计主要是有效的,但是对于每个版本的Windows来说,都会变得更糟,因为新的障碍物是为了部署的。一方面,自我修复通常在终端服务器上根本不起作用使设置不完整。尽管这是讨论的重点,但最好将应用程序复制文件复制到每个用户位置。另一个问题是UAC。每个新的Windows版本都显示出其他问题,甚至如上所述的一些Windows更新(虚拟文件夹重定向,证书提示,以前不存在的目标路径限制等...)。
  • 当需要设置用户数据时,可能需要花费很长时间,以至于用户中止它并继续这样做。这会使自我修复一直重新出现,直到允许完成为止。 一个通用的支持电话
  • 也可以使用“ 强> “被设计为安装” 按需“在应用程序使用过程中触发”。很少有应用程序使用此功能,但是当它被使用时,可能会运行冗长的“自我修复样式”安装程序 - 拉下所需的文件和设置。 如果此过程被取消,则该功能的安装被向后滚动,并且可以再次触发。此安装可以是 slow 几个原因
    • 如果安装程序使用的 首次下载的大型,压缩的驾驶室文件然后在 慢速磁盘上 ,其中抗病毒开始扫描整个驾驶室,然后每个提取的文件可能需要很长时间。
    • 如果网络连接是无线>,并且有很多小文件要下载(高潜伏期),则操作也可能很慢。抗病毒再次可以放慢速度。
    • 如果从可移动媒体中安装,您可以获得提示以插入源媒体以允许复制文件。如果在办公室环境中使用可移动媒体,则非常常见的支持调用(不应该 - 使用 admin在网络共享上安装
    • 等...

Self-Repair, Simple & Short Explanation: Why does the MSI installer reconfigure if I delete a file?


Alternative Answer Available

UPDATE:
There is a shorter, more "solution focused" answer available, perhaps try it first. This answer focuses on "understanding self-repair" rather than explaining the steps to take to eliminate the problem. You might want to read the first section of this answer as well.


Unexpected Windows Installer self-repair issues - Quick Fix?

This "article" has gotten large and somewhat unreadable. Here is a newly written preamble - the short "workaround version" for fixing unexpected self-repair (often found in VB6, Visual Studio, MS Office, MS Outlook, AutoCAD, etc...)

  • If you experience unexpected self-repair, the first thing you can try is to manually create a desktop shortcut directly to the application executable you are launching when the problem occurs. This bypasses the most common trigger of self-repair, "the advertised shortcut". If this works your problem is "solved" (or avoided). Here is a quick, fleshed-out explanation
  • If the problem still occurs, or your problem is related to the loading of an MS Office, MS Outlook add-in or similar (that you can't launch via a shortcut), then you most likely have a COM registration conflict on your system, and the fix is much more involved. The easiest to try is to disable any addins you don't need in the addins dialog of the application in question and see if this makes the problem go away
  • If you still see problems, then you most often need to debug a genuine COM registration conflict (or conflicting file/MIME associations, or command verbs). This normally involves (at least) two conflicting applications on your system that "fight it out" updating the registry on each launch after the other application has run (always launching one of the apps will not trigger the self-repair - the conflict surfaces when you alternate between applications). It is also possible that permission problems cause the same application to fail to update the system and it keeps trying endlessly by repeatedly running self-repair. And there are further possibilities, more details below
    • The "real fix" is to contact both application vendors and ask them for a fix for the problem (since a fix often requires a fix of both vendor MSIs), but in my experience this is rarely successful. Do try it out though - since this is the way to help everyone with a long-standing annoyance! I have personally provided a setup with fixes for a bank deployment and was very happy to have the problem solved in my package
    • To debug yourself, you need to get hold of a tool to open cached MSI files on the system and you need to "hack" the database - a very involved task requiring expert skills, you would be advised to seek an installation expert for help if the problem is very serious for your desktop environment. It can work, but don't expect miracles.
    • Please see the section below called "Finding the trigger or culprit for the self-repair" for more details on obtaining a tool to view and modify MSI files

The rest of the "article" describes self-repair problems in depth. There are many other potential causes of self-repair than what is described in this "short" section.


Overall Problem: Developer debugging and self-repair

Windows Installer is a deployment technology, its job is to install the specified files and registry settings and keep them in the specified install locations and to ensure they are the right versions - self-repair or resiliency is a mechanism to that end. Its operation conflicts with a developers need to exchange files on the fly for debugging, development and testing.

Accordingly, many self-repairs (resiliency) are triggered simply by developers trying to debug their installed application and hot-swapping files on the fly. See section 2 in "Some typical self-repair problem scenarios" below for how to handle this. In other cases there are genuine design errors in the MSI that must be corrected or system administration pitfalls that lead into self-repair - and at times the error source can be hard to find.

I have written about the issue of self-repair in an answer on serverfault.com. Slightly different words intended for system administrators, and reading it now it might be a more accessible explanation than this long one (intended for developers). There is also another, shorter answer here on stackoverflow: Why does the MSI installer reconfigure if I delete a file? (this is probably the shortest one and easiest to understand). And finally I found a very nice article on self-repair by Vadim Rapp: How to fix Windows Installer Efforts to Self-Repair. This article is well worth a read.

No self-repair will occur if Windows Installer determines that the product being launched is properly installed. When self-repair occurs something needs to be changed on the system for the application to run properly.


The Primary Causes of Self-Repair

The details are presented below in the section "Some typical self-repair problem scenarios", but as a quick, foreshadowing list - the primary causes are:

1. Badly packaged corporate MSI files or MSI design flaws from the vendor (the MSI package itself is badly designed and triggers self-repair unexpectedly for a variety of reasons)

  • Excessive or erroneous use of per-user files or per-user registry keys often with erroneous key paths set into the user profile (instead of HKCU). See section 5 below for more details (and a color illustration of such a situation)
  • Package interference from erroneous COM server registration (particularly VB6 COM files or VBA files and libraries from products such as AutoCAD from Autodesk, and similar products).
    • Two MSI packages register the same COM file (ActiveX/OCX) from two different locations and "self-repair fight" on each application launch to keep their version correctly registered.
    • The last application to launch puts the registry right for itself, and it lasts until the other application is launched and does the same. Once you alternate between applications the problem occurs. See section 7 below for a lot more VB / COM self-repair detail
  • A component key path is set to an empty folder that Windows installer removes on self-repair (triggering an endless loop of removal and subsequent self-repair)
  • ACL lockdown permission problems (logged on user can not access key file and Windows Installer triggers repair repeatedly). This can also be caused by ACL changes done externally, but is often done by the MSI itself
  • Here is a serverfault.com work-in-progress describing common MSI design flaws

2. Files or registry keys are deleted by interference from external causes ranging from (logon) scripts to standard OS features, viruses, security software, etc...

  • Temporary files are deleted automatically by Windows after being erroneously installed to the temp folder by an MSI package
  • Interference from bad logon- and trigger happy cleanup scripts and cleanup applications
  • Antivirus applications blocking or deleting files or registry keys so that Windows Installer can no longer detect or access them
  • Computer viruses changing or deleting files and registry settings
  • Overactive computer tinkerers and users delete files and settings they don't understand

3. Windows design changes, flaws or restrictions that causes flawed or problematic deployment

  • An AD-advertised MSI package fails to install (might be cancelled since it takes too long to install) and keeps bugging people. This is strictly speaking not self-repair but an advertised install that is aborted, but the result is the same: endless reinstall
  • Terminal server complications. Self-repair is generally disabled altogether on terminal servers. This does not normally cause self-repair problems, but application installs without the required per-user files or registry keys that can be added via benign use of self-repair (read below). The user files and user registry keys are then just missing and problems result
  • UAC interference, certificate validation failure and other problems resulting from Windows design changes. For every version of Windows security features like these are added and normally end up adding new obstacles for reliable deployment
  • Even certain Windows Updates (updates, security updates, hotfixes, etc...) can make drastic changes to how security is enforced for MSI packages, and hence cause extremely problematic behavior
    • Though this relates to MSI creation, and not primarily their end-user use, the Windows Update KB3004394 which updates the way Windows checks for revoked root certificates, breaks older version of Installshield's command line build (for setups that were digitally signed). Largely a resolved issue by now, but an illustration of how Microsoft keeps changing core MSI functionality
    • In a similar manner Installshield crashed for many users after installing Microsoft update MS14-037 “Security update for Internet Explorer versions 6, 7, 8, 9, 10, and 11” (KB2962872)
    • An extremely problematic change in Windows Installer base functionality occurred after installing kb2918614 (Vista). Suddenly administrator credentials were required for a simple MSI repair operation. This defeated a core benefit of MSI altogether: the ability of regular users to run approved installs with temporary admin rights. There were also other reported MSI problems after installing that fix. It appears another Windows update fixed the issues: kb3008627 (later replaced by kb3072630)

About Self-Repair

Windows Installer is designed to install your application's binaries, settings- and data files and keep them installed and ensure they are the right versions. Self-repair is a mechanism to that end. The overall concept is called resiliency - i.e. a broken installation triggers a self-repair before the application is launched.

Resiliency, or self-repair, is a built-in primary concept of Windows Installer and can not be turned off in any way that is safe. People do the most incredible things sometimes, such as disabling the whole Windows Installer engine to stop their self-repair. This must obviously never be done. The cause of the repair must be identified, and the problem resolved rather than creating new ones, or hacking the system.

Every time you launch an advertised shortcut (essentially a special shortcut that points to a Windows Installer feature and not directly to a file), Windows Installer will verify the installation by checking the "component key paths" for your product. If a discrepancy is found, a repair is triggered to correct the incomplete installation. The "component key paths" are the "key files" specified for the components inside your MSI - there is one per component. Self-repair can also be initiated by someone instantiating a COM server (or attempting to), someone activating a file via its file extension or MIME registration, and a few other ways. Here is a comprehensive article from Symantec on the subject of "self-repair entry points": Initiating Self-Repair and Advertising Features with Entry Point.

If files are deleted, moved or simply overwritten (manually by a user or somehow automatically), self-repair may result (if the file or registry setting isn't set as a key path self-repair is not triggered).


Finding the trigger or culprit for the self-repair

The trigger for the self-repair is generally possible to find in your event viewer on the system where the self-repair took place. Follow these steps to open the event viewer:

  • Right click "My Computer"
  • Click Manage
  • Click continue if you get an UAC prompt
  • Go to the Event Viewer section, and check the Windows Logs

Alternatively you can do: Start => Run... => eventvwr.exe for just the event viewer. If you don't see run in the start menu, press WINKEY + R.

enter image description here

  • Look in the "Application section" of the event log and you should find warnings from the event source "MsiInstaller" with IDs 1001 and 1004
  • In the sample screen shot above the product code is shown inside the red box
  • In order to determine what product the product code is for, you can look up the product name via the procedure explained here: How can I find the product GUID of an installed MSI setup?
  • If you actually want to go in deep and check the actual content of the MSI file, you must get hold of a tool capable of viewing a MSI file (such as Orca, Installshield, Advanced Installer or similar). You then open the package listed in the "LocalPackage" path listing as illustrated in the screen shot found in the answer linked to in the previous bullet point.
  • The actual modification of the system-cached MSI file and/or the registry to remove advertised entry points such as (advertised) shortcuts, COM registration, file associations, MIME associations or command verbs is a specialists job. It is very involved and not good practice, but it is the only "last resort" that I know about.
  • Finally it is possible for an application to explicitly call Windows Installer itself to trigger self-repair for shared components - for example a spell checker. I believe a few versions of Microsoft Access did this, and this behavior can not be changed or worked around as far as I know.

MSI-expert and MVP Stefan Krüger has an article about the same self-repair issue. And he crucially discusses the actual event log entries and what they mean. Please read about the actual debugging procedure there.


Some typical self-repair problem scenarios:

This is the "verbose explanation" of several self-repair problem scenarios already outlined in the overview above.

  1. A component key path is set to an empty folder that Windows installer removes on self-repair (triggering an endless loop of removal and subsequent self-repair). This is solved by adding the folder to the CreateFolder table instead (Wix equivalent). In my experience this is the most common scenario for unwanted self-repair. Very common.
  2. Many self-repair problems are actually caused by developers trying to debug their applications by replacing files on the fly, deleting files or renaming them. Or they may use cleanup registry scripts and / or batch scripts to unregister and register COM files, COM-Interop, GAC files, file associations, or other common developer debug and development tasks.

    • This hot-swapping can triggering self-repair when the application is launched via an advertised shortcut.

    • A top tip for developers struggling with self-repair during application debugging is to not launch the application from an advertised shortcut, but to launch the main EXE directly from Windows Explorer or from a manually created shortcut. This will bypass the most common "self-repair entry point" - the advertised shortcut. Self-repair may still result from broken COM data, advertised file associations and a few other special cases (read this Symantec article for entry point information).

  3. Other applications or rather other MSI packages can break your installation and cause self-repair by interfering with registry data - typically COM settings, but also with other settings and files. These can be some of the hardest cases to solve, since the applications are basically fighting it out and the last one to run will update the registry each time. Typically both MSI files must be redesigned for the applications to operate on the same machine. Or, as is the order of the day, the whole application may be virtualized (for example: Microsoft App-V virtual packages) and run in its own sandbox which seems to be what is done more and more in companies these days. This error scenario is often seen with a suite of badly repackaged applications in a corporate environment. COM fragments from different packages overwrite the COM server's disk path from another package, and self-repair fighting ensues on each application launch via an advertised shortcut. The same file name with different file versions can also be registered from different file locations and share some registry settings that interfere. As far as I recall at least 7 variables or settings in the file system and registry must be in sync for a COM server to be properly instantiable. See section 7 below for a more specialized description of COM interference in the context of VB6 and VBA COM applications.

  4. A component key path is pointing to a temporary file that has been deleted by the application or it will be deleted by the system eventually via some sort of cleanup mechanism (can also be a cleanup tool such as ccleaner). This is common for files in the temp folder itself. This is solved by not installing the temp file, or putting the file somewhere else and making it permanent. I have seen this error most often in the world of corporate application repackaging where a faulty cleanup of the captured image leads to the install of a temporary file that should not have been included in the package at all. Often they may be temporary files waiting for a reboot to be installed to their intended, perhaps protected location, and the reboot was never performed - a common application packaging error. To a lesser degree I have seen it in auto-generated packages coming out of automated build systems.

  5. Permission problems: if a key file for a component is installed to a location that is not accessible for the user who invokes the application. Windows Installer might not "see" the installed file / key path, or be unable to add the file to the folder. These issues can be more exotic to debug, and may not happen that often. There are several variations on this issue:

    • An example of this is when you install a file to a %USERPROFILE% path and then forget to set a HKCU registry keypath, and instead set the keypath to point to the %USERPROFILE% folder/file. This generally yields an inaccessible hard coded key path that is user-specific: C:\Documents and settings\user1\Desktop. This path will not be found for another user logging on, and self-repair runs in circles. Here is a color illustration.
    • Another example is key paths set to folders that are not writeable for the System account. This may seem exotic but can result from the MSI's faulty modification of system ACL entries, or from a strange system administrator security setup, or any other non-standard ACL / Security Descriptor.
  6. Another class of self-repair problems emerges in relation to terminal servers and Citrix. The whole windows installer service could be locked down so any self-repair invoked to add per user data could fail and consequently self-repair may fail or more likely not run at all. This is reason enough to not rely on self-repair as a way to add user data like some MSI files do, and such constructs must be replaced with application deployment of user files copied from per-machine locations or the less effective ActiveSetup feature from Microsoft that runs once per user.

  7. VB6 applications and VBA applications, which are heavily COM based with massive potential for COM interference (COM settings overwriting each other and becoming inconsistent), have been known to trigger several mysterious self-repair problems, most of which have not been properly explained. This can also happen on launch of Visual Basic 6 (VB6) or Visual Studio (and many other applications). The common denominator is that some error in the current installation state triggered the self-repair, and you can track down the culprit product and component by following the steps outlined in the section above called "Finding the trigger or culprit for the self-repair". Be sure to report your findings here (I never use VB6 or VBA anymore - your detailed findings could help others with a long-standing annoyance).

    • Though I have never debugged such VB6 issues in great detail, it would seem that the problems result from applications that install common controls, VB6 COM files, templates and VBA files and libraries that conflict with existing files and registry settings and registrations on the box, or some per-user registry key or userprofile file may need to be added once per user (allow the self-repair to complete once and see if the problem goes away). In particular I have heard of these mysterious self-repair problems when launching AutoCAD (from Autodesk), Visual Basic 6, and several other products (often with VBA automation available in the tool).
    • Some applications even erroneously install bits and pieces from the VB6 runtime on their own causing these settings to be "ripped out" on uninstall of those applications. This can certainly cause self-repair to be triggered to fix the now (partially?) broken VB6 runtime. There are several variants of this problem, and the "catch all" solution is probably a complete uninstall and reinstall of the VB6 runtime. Here is a description of a very common "specific" problem involving a few COM registry keys. It nicely illustrates what happens in this scenario.
    • If you experience unexpected self-repair when launching VB6, AutoCAD, Visual Studio or other products, you can first try a workaround to prevent these unexpected self-repairs from happening in the first place (this doesn't solve the problem, but may bypass its symptoms): why does windows installer start up everytime i start up visual basic 6
    • See my comment to the question in this topic for one of the most typical VB6 style self-repairs: Why does my application triggers the Installer of another application? (ActiveX control registered twice from two different locations on disk).
    • In my opinion the "general fix" - that should always work - for VB-COM self-repair issues, is to get the vendor to update their project in question to use the latest official and properly installed and shared ActiveX control / OCX available, and not to rely on their own version installed redundantly and registered in the wrong location.
  8. A special case of Windows Installer repair or self-repair that is worth mentioning for completeness, was the issue with Microsoft Office several years ago where a self-repair would be triggered, and you would be asked to insert the Microsoft Office installation media (in those days CD-ROMs or DVDs - today maybe thumb drives). As far as I recall this was related to an erroneous call to the built in Windows Installer standard action "ResolveSource" which unexpectedly (and unnecessarily) triggered the prompt for the installation media. A very common support call back in the day and mentioned here for completeness. It is important to note that this problem can still occur whenever MS Office is installed from any removable media (rather than the better option of a network share). This happens when MS Office detects that it needs to install further, optional (and usually shared) components of the product that were not installed originally. For example unusual spell-checkers, various templates or specific and rarely used tools. It is possible to install these components to "install on first use" (advertised features is the proper Windows Installer term).

  9. There are many other possible scenarios. To mention a few:

    • a bad logon script may delete things on the system and trigger self-repair
    • an AD advertised package may fail to install and keep bugging people
    • two applications may start fighting for the same file associations
    • computer tinkerers and hackers can manually delete data that trigger self-repair
    • anti-virus can quarantine files and registry settings that trigger repair
    • a virus can change or delete things and trigger self-repair
    • a disk and registry cleanup tool such as ccleaner can delete files and trigger self-repair
    • and no doubt numerous other scenarios...

Benign uses for self-repair

Finally there are benign uses for self-repair that happen once and do not constitute errors. This is the legal and proper use of self-repair though it may be just as annoying as the design errors, and with user intervention they can pop up again and again:

  • Self-repair is sometimes used to add per-user data to HKCU and the user profile. This design mostly works, but gets worse for every version of Windows as new obstacles are put in place for deployment. For one thing self-repair typically does not work at all on terminal servers rendering the setup incomplete. Though it is besides the point for this discussion, it is better to have the application copy files to per-user locations. Another issue is UAC. Other problems show up with each new Windows version and even with some Windows Updates as described above (virtual folder redirects, certificate prompts, previously non-existing target path restrictions etc...).
  • When self-repair is needed to set up user data, it may take so long that the user aborts it and keeps doing so. This causes the self-repair to reappear all the time until it is allowed to finish. A common support call.
  • It is also possible to install a product with "advertised features" that are designed to be installed "on demand" triggered during application use. Few applications use this, but when it is used a lengthy "self-repair style" installer may run - pulling down the required files and settings. If this process is cancelled the installation of the feature is rolled back and it can be triggered again. This install can be slow for several reasons:
    • If the installer used large, compressed CAB files that are first downloaded and then extracted locally on a slow disk where the anti virus starts scanning the whole cab and then each extracted file the operation can take a long time.
    • The operation can also be slow if the network connection is wireless and there are lots of small files to download (high latency), and again the anti virus could slow down things.
    • If installed from removable media, you could get prompts to insert the source media to allow files to be copied. A very common support call if removable media is used in an office environment (it shouldn't be - use an admin install on a network share)
    • Etc...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文