如何压制对话框

时间:2015-03-17 15:47:59

标签: .net xml dialog wix windows-installer

我已将以下对话框标记为在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。我只是不需要以某种方式向用户显示它,或者(如果可能的话)为它们选择一个选择。

1 个答案:

答案 0 :(得分:3)

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

How do I prevent the FilesInUse Dialog from displaying?

  

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

     

根据您的创作工具,这相当于标记   对话框是&#34;隐藏&#34;,&#34;无模式&#34;,&#34; NoMinimize&#34;。

     

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