WixMSI卸载非常慢日志显示删除快捷方式时的速度很慢

问题描述

发现了一个类似的问题,但是被接受的“答案”实际上根本不是答案:MSIEXEC: "Executing op: ShortcutRemove" step is very slow

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

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

所有快捷方式均在本地C:驱动器上创建,而目标文件位于同一驱动器上。

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

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

该项目多年来拥有如此众多的快捷方式,但我只是在2019年中期才开始注意到卸载速度变慢。

构建环境/工具

Visual Studio Pro 2017

Wix版本3.11.2.4516

Windows Installer。 V 5.0.19041.1

更新1-2020年8月28日

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

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

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

慢速:Microsoft Windows Server 2019 数据中心,版本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>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)