【问题标题】:How to suppress a dialog如何抑制对话
【发布时间】:2015-05-20 03:35:16
【问题描述】:

我已在 WiX 中将以下对话框标记为隐藏,但当文件正在使用时,它仍会在卸载时显示:

<Dialog Id="FilesInUse" X="50" Y="50" Width="361" Height="177" Title="[ProductName] Files in Use" Hidden="yes">
  <Control Id="RetryButton" Type="PushButton" X="99" Y="150" Width="81" Height="18" Text="{\VSI_MS_Sans_Serif13.0_0_0}&amp;Try Again" TabSkip="no" Default="yes">
    <Publish Event="EndDialog" Value="Retry" />
  </Control>
  <Control Id="ContinueButton" Type="PushButton" X="186" Y="150" Width="81" Height="18" Text="{\VSI_MS_Sans_Serif13.0_0_0}&amp;Continue" TabSkip="no">
    <Publish Event="EndDialog" Value="Ignore" />
  </Control>
  <Control Id="ExitButton" Type="PushButton" X="273" Y="150" Width="81" Height="18" Text="{\VSI_MS_Sans_Serif13.0_0_0}E&amp;xit Installation" TabSkip="no" Cancel="yes">
    <Publish Event="EndDialog" Value="Exit" />
  </Control>
  <Control Id="ListFilesInUse" Type="ListBox" X="8" Y="64" Width="348" Height="62" Property="FileInUseProcess" Text="{\VSI_MS_Sans_Serif13.0_0_0}MsiFilesInUse" TabSkip="no" Sunken="yes" Sorted="yes" />
  <Control Id="InstallBodyText" Type="Text" X="6" Y="9" Width="345" Height="43" Text="{\VSI_MS_Sans_Serif13.0_0_0}The following applications are using files which the installer must update. You can either close the applications and click &quot;Try Again&quot;, or click &quot;Continue&quot; so that the installer continues the installation (a reboot may be required to replace these files on a restart)." TabSkip="yes" NoPrefix="yes">
    <Condition Action="show"><![CDATA[REMOVE=""]]></Condition>
    <Condition Action="hide"><![CDATA[REMOVE<>""]]></Condition>
  </Control>
  <Control Id="RemoveBodyText" Type="Text" X="6" Y="9" Width="345" Height="36" Text="{\VSI_MS_Sans_Serif13.0_0_0}The following applications are using files which the installer must remove. You can either close the applications and click &quot;Try Again&quot;, or click &quot;Continue&quot; so that the installer continues the installation (a reboot may be required to replace these files on a restart)." TabSkip="yes" NoPrefix="yes">
    <Condition Action="show"><![CDATA[REMOVE<>""]]></Condition>
    <Condition Action="hide"><![CDATA[REMOVE=""]]></Condition>
  </Control>
</Dialog>

我怎样才能取消这个对话框?

注意:此对话框必须存在,否则安装程序会抛出 error 2803: dialog view did not find a record for the dialog。我只需要不以某种方式向用户显示它,或者(如果可能的话)为他们选择一个选项。

【问题讨论】:

标签: .net xml dialog wix windows-installer


【解决方案1】:

根据 installsite 上的提示(见下文),这似乎是不可能的,因为这是 Windows 操作系统的行为。根据我自己的经验,绕过此问题的另一种方法是使用自定义操作来检测正在运行的进程,然后提示用户该进程正在运行,在卸载前关闭该应用程序。在运行时卸载应用程序并不好,它可能会留下一些文件和注册表项,除非您下次进行干净卸载或手动删除它们。

How do I prevent the FilesInUse Dialog from displaying?

为 FilesInUse 设置 Dialog 表的 Attributes 列 对话框到 0。

根据您的创作工具,这相当于标记 对话框被“隐藏”、“无模式”和“NoMinimize”。

请注意,此技巧仅在您的设置以完整或精简的用户界面运行时才有效。在基本 UI 模式下,Windows Installer 使用其 拥有内置对话框,而不是您在 msi 中创作的对话框 文件。

【讨论】:

  • 我尝试在对话框上设置NoMinimize="yes" Hidden="yes" Modeless="yes",但就像你说的,在卸载过程中,它以基本 UI 模式运行,因此,MSI 显示了自己的 FilesInUse带有以下文本的对话框:The following applications should be closed before continuing the install。您可能是对的,因为我找不到解决方案。我试图通过强制卸载完整的 UI 来查看是否可以破解它。你不能。
  • 父应用程序使用我的应用程序(也不断重新启动它)。我无法杀死父应用程序,因为客户可能会丢失他们的数据,所以我等待他们关闭父应用程序并通过提示阻止执行。然后我在父母死后和安装之前杀死我的应用程序。提示的自定义操作需要管理员权限才能访问注册表和获取活动进程,因此我必须将其放在InstallInitialize 之后和InstallFinalize 之前(必须推迟)。问题是这个 FilesInUse 对话框出现在 InstallInitialize 之前。这是一个先有鸡还是先有蛋的问题。
  • 我想再给它几天时间,看看其他人是否有任何其他解决方法或想法,但如果他们没有,我将奖励你赏金,因为这是一个棘手的问题,并且可能根本没有直接的解决方案。
  • @Alexandru 玩 Windows 有时会出现这种情况,MSI 服务对我们这样的客户端来说是一个黑盒子,而不是公共 API。我也期待其他人有一个简单的解决方案,这个问题对于一些 Windows 安装程序用户/开发人员来说听起来很常见。
猜你喜欢
  • 1970-01-01
  • 2010-11-01
  • 2011-03-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-18
相关资源
最近更新 更多