Wix:如何使用FileInUse对话框

时间:2012-04-26 04:31:31

标签: installation wix windows-installer

安装应该要求关闭所有浏览器:iexplore.exe,chrome.exe和firefox.exe,但是应该提示用户这样做。我无法得到FileInUse对话框。以下是相关部分 - 我缺少什么?使用CloseMessage =“yes”,它们都会关闭,但我希望FilesInUse会出现。

<UI>
  <UIRef Id="WixUI_InstallDir" />
  <UIRef Id="WixUI_ErrorProgressText" />
  <DialogRef Id="FilesInUse" />
  <DialogRef Id="MsiRMFilesInUse" />
</UI>

<InstallUISequence>
  <Custom Action="WixCloseApplications" Before="AppSearch" />
</InstallUISequence>

<InstallExecuteSequence>
  <Custom Action="WixCloseApplications" Before="InstallValidate" />
</InstallExecuteSequence>

<util:CloseApplication Id="CloseIE" CloseMessage="no"
                       Description="Internet Explorer is still running."
                       ElevatedCloseMessage="no"
                       RebootPrompt="no"
                       Property="IERunning"
                       Target="iexplore.exe"/>
<util:CloseApplication Id="CloseChrome" CloseMessage="no"
                       Description="Chrome is still running."
                       ElevatedCloseMessage="no"
                       RebootPrompt="no"
                       Property="ChromeRunning"
                       Target="chrome.exe"/>
<util:CloseApplication Id="CloseFirefox" CloseMessage="no"
                       Description="Firefox is still running."
                       ElevatedCloseMessage="no"
                       RebootPrompt="no"
                       Property="FirefoxRunning"
                       Target="firefox.exe"/>

更新 从日志中,似乎发生了一些事情,但没有接近也没有提示。下面的日志发生了两次(正如我预期的那样),一次在AppSearch之前,一次在InstallValidate之前,但从未调用过FileInUse对话框。我尝试将WixUI_InstallDir更改为Mondo,但这没有帮助。

Action 22:28:12: WixCloseApplications. 
Action start 22:28:12: WixCloseApplications.
WixCloseApplications:  Entering WixCloseApplications in C:\Users\tim\AppData\Local\Temp\MSIC78D.tmp, version 3.6.2809.0
WixCloseApplications:  Checking App: iexplore.exe 
WixCloseApplications:  App: iexplore.exe found running, 2 processes, setting 'IERunning' property.
WixCloseApplications:  Checking App: chrome.exe 
WixCloseApplications:  App: chrome.exe found running, 7 processes, setting 'ChromeRunning' property.
WixCloseApplications:  Checking App: firefox.exe 
Action ended 22:28:13: WixCloseApplications. Return value 1.

2 个答案:

答案 0 :(得分:3)

在纠结了同样的问题一段时间后,我想我可以说你无法解决这个问题

请注意,问题是只有Win7和Vista具有允许您检测正在运行的程序的Restart Manager,以及仅使用您的文件的。这就是FilesInUse对话框的用途。你可能现在意识到如果没有安装这些文件就无法使用,所以它就是:你无法按照你尝试的方式解决它。事实上,你在WinXP中根本没有重启管理器。

我发现的其他解决方案是:

  • 继续您的开始方式,但使用大量自定义操作
  • 制作自己的对话框
  • 在C / C ++中创建自定义操作Dll,可以检查正在运行的进程并通知MSI显示FilesInUse对话框。 (您必须了解如何制作自定义操作DLL,但我建议您使用此解决方案)

希望如果你还没有解决它,这对你有帮助。

答案 1 :(得分:0)

旧问题的新答案。可以帮助别人。这是:

在这些情况下ClosePromtCA应该可以很好地运作。它只是强制用户关闭指定的进程 - 在chrome.exe,firefox.exe上面的情况下...此外,自定义操作是开源的,因此应该很容易根据您的需要进行调整。