首页 > 解决方案 > (Wix) MSI 卸载非常慢。日志显示缓慢是删除快捷方式时

问题描述

发现了一个类似的问题,但接受的“答案”实际上根本不是答案:MSIEXEC:“执行操作:ShortcutRemove”步骤很慢

卸载快捷方式时,Wix / Windows Installer 是否存在非常慢的已知问题?

我有一个 msi 项目,它在我的安装文件夹中创建了很多(85+)快捷方式。当我安装时,一切都进行得很快,并在一分钟内成功完成。但是,当我卸载时,它需要超过 6-8 分钟。计算机是具有快速 SSD 的物理机器。在 Windows 10 Pro 和 Windows Server 2019 上测试。

所有快捷方式都在本地 C: 驱动器和同一驱动器上的目标文件上创建。

我对 Wix 和 Windows Installer 不是很有经验,但卸载日志对我来说看起来很干净。只有ShortcutRemove操作花费的时间比预期的要长,并且每个操作都有“ Note: 1: 2318 2: C:\Config.Msi\??????.rbf ”(文件不存在)。每个 ShortcutRemove 操作需要 4 到 5 秒,这显然是因为我需要创建的快捷方式数量(确实很高)。

从日志中,显示错误“注意:1:2318”的每一行与以下“执行操作:SetTargetFolder”行之间大约有 3 秒的延迟。

该项目多年来一直有这么多快捷方式,但我直到 2019 年年中才开始注意到卸载速度放缓。

构建环境/工具

视觉工作室专业版 2017

蜡版本 3.11.2.4516

Windows 安装程序。V 5.0.19041.1

更新 1 - 2020 年 8 月 28 日

我怀疑这可能是 Windows o/s 补丁或新安全策略的问题,因为几年来我一直在使用相同的 .msi 和 Wix 项目,并且在 2019 年中期之前没有看到 Windows 10 的速度下降- 我在顶部引用的相关帖子也来自那个时期。我还怀疑这可能发生在许多其他 .msi 项目中,但开发人员没有注意到,因为他们只有很少(正常)数量的快捷方式。

此外,我刚刚在 Windows Server 2016 上进行了测试,发现卸载在该操作系统上一点也不慢!

快速: Microsoft Windows Server 2016数据中心,版本 1607(操作系统内部版本 14393.3564)

慢: Microsoft Windows Server 2019 Datacenter,版本 1809(操作系统内部版本 17763.1397)

慢: Microsoft Windows 10 Pro,2004 版(操作系统内部版本 19041.450)

这是卸载日志的摘录:

MSI (s) (98:54) [13:09:59:071]: Using source file security for destination.
MSI (s) (98:54) [13:09:59:073]: Note: 1: 2318 2: C:\Config.Msi\13a736b0.rbf 
MSI (s) (98:54) [13:10:01:503]: Executing op: SetTargetFolder(Folder=23\My Tiny Utilities\)
MSI (s) (98:54) [13:10:01:508]: SHELL32::SHGetFolderPath returned: C:\ProgramData\Microsoft\Windows\Start Menu\Programs
MSI (s) (98:54) [13:10:01:509]: Executing op: ShortcutRemove(Name=lddyopzj|Touch)
MSI (s) (98:54) [13:10:01:513]: Verifying accessibility of file: Touch.lnk
MSI (s) (98:54) [13:10:01:515]: Using source file security for destination.
MSI (s) (98:54) [13:10:01:516]: Note: 1: 2318 2: C:\Config.Msi\13a736b1.rbf 
MSI (s) (98:54) [13:10:03:964]: Executing op: SetTargetFolder(Folder=C:\MyTinyUtilities\Shortcuts\)
MSI (s) (98:54) [13:10:03:966]: Executing op: ShortcutRemove(Name=n5w0rmgl|Touch)
MSI (s) (98:54) [13:10:03:970]: Verifying accessibility of file: Touch.lnk
MSI (s) (98:54) [13:10:03:974]: Using source file security for destination.
MSI (s) (98:54) [13:10:03:977]: Note: 1: 2318 2: C:\Config.Msi\13a736b2.rbf 

这是我的快捷方式创建脚本/代码的摘录:

  <!--Start Menu Shortcuts-->
  <Fragment>
    <DirectoryRef Id="DirShortcutsStartMenu">
      <Component Win64="no" Id="CMP_Shortcuts_StartMenu" Guid="86F485AE-B257-4E8A-8D06-59EE9161B8F9">

        <RegistryValue Root="HKCU" Key="Software\MyTinyUtil" Name="Start Menu Created" Type="string" Value="Yes" KeyPath="yes" />
        <Shortcut Id="SM_Touch" Name="Touch" Description="Update file modified date" Target="[MTUINSTALLROOT]Touch.exe" />
        ...
        I create about 10 shortcuts on the Start menu path
        ...
        <RemoveFolder Id="Remove01" On="uninstall" />

      </Component>
    </DirectoryRef>
  </Fragment>

  <!-- Shortcut in installation Folder-->
  <Fragment>
    <DirectoryRef Id="DirShortcutsInstallFolder">
      <Component Win64="no" Id="CMP_Shortcuts_InstallFolder" Guid="102EC0F4-03BD-48E9-8086-6D5DA4624FA3">
      
        <RegistryValue Root="HKCU" Key="Software\MyTinyUtil" Name="Duplicate Shortcuts" Type="string" Value="yes" KeyPath="yes" />
        <Shortcut Id="IF_Touch" Name="Touch" Description="Update file modified date" Target="[MTUINSTALLROOT]Touch.exe" Directory="Dir_C_Shortcuts_File_Utils" />
        ...
        I create in excess of 85 shortcuts in a sub-folder of my installation folder.
        ...
        <RemoveFolder Id="Remove02" On="uninstall" />

      </Component>
    </DirectoryRef>
  </Fragment>

标签: msbuildwixwindows-installer

解决方案


推荐阅读