Sem*_*nit 4 windows-installer wix restartmanager
我遇到的问题是,在卸载(或升级)时,重新启动管理器抱怨某个文件正在使用中,因此强制重新启动:
RESTART MANAGER: Detected that application with id 7000, friendly name 'javaw.exe', of type RmCritical and status 1 holds file[s] in use.
RESTART MANAGER: Did detect that a critical application holds file[s] in use, so a reboot will be necessary.
Run Code Online (Sandbox Code Playgroud)
RESTART MANAGER抱怨的服务是基于Java的服务。服务(此处称为myservice.exe)以递归方式启动java子进程:
myservice.exe-
运行
↳javaw.exe --someArguments↳someother.exe
--someArguments↳javaw.exe --someMoreArguments
服务定义的wix代码段:
<DirectoryRef Id="BINDIR">
<Component Id="myservice.exe" Guid="PUT-GUID-HERE">
<File Id="myservice.exe" KeyPath="yes" Vital="yes"
Source="SourceDir\bin\myservice.exe"/>
<ServiceInstall Id="MyService" Type="ownProcess"
Vital="yes" Name="MyService" DisplayName="My Service"
Description="My Service" Start="auto" Account=".\LocalSystem"
ErrorControl="normal" Interactive="no" Arguments="--run"/>
<ServiceControl Id="MyService" Name="MyService" Wait="yes" Remove="uninstall" Stop="uninstall" Start="install"/>
</Component>
</DirectoryRef>
Run Code Online (Sandbox Code Playgroud)
现在,有趣的部分:
卸载时:
到目前为止,“服务*”表中的条目对我来说似乎很好。
ServiceControl-Table:
ServiceControl Name Event Arguments Wait Component_
MyService MyService 161 1 myservice.exe
ServiceInstall-Table:
ServiceInstall Name DisplayName ServiceType StartType ErrorControl LoadOrderGroup Dependencies StartName Password Arguments Component_ Description
MyService MyService My Service 16 2 32769 .\LocalSystem --run myservice.exe My Service
Run Code Online (Sandbox Code Playgroud)
因此,请分解所有内容:
似乎重新启动管理器无法识别Java进程是子进程,并且将被StopServices操作停止。
我在这里发现了类似的问题:
https
://www.mail-archive.com/wix-users@lists.sourceforge.net/msg57924.html Wix安装程序问题:为什么RestartManager将Service标记为RMCritical而不是RMService
在此先感谢您为解决此问题提供的任何帮助!
您可以通过以下几种方法解决此问题:
-通过使用属性表中的MSIRESTARTMANAGERCONTROL =“禁用”来禁用“重新启动管理器”。这将在旧版“ FilesInUse”对话框中启动。在您的情况下,也可能不会显示FilesinUse对话框(因为服务没有与之关联的窗口) “ FilesinUse”对话框没有列出没有与之关联的窗口的进程。因此,在您的情况下,禁用重新启动管理器可能不会显示任何对话框(FilesInUse和RestartManager都不显示)。
但是,这也意味着可能需要重新启动,这不一定是由于您的服务,而是由于某些其他过程可能正在使您的文件处于使用状态。如果您认为除了您自己的服务持有文件之外别无其他流程,请继续按照此方法进行操作。如果您认为除了服务保存文件之外,可能还有其他进程,那么启用 “重新启动管理器” 是理想的选择。没有“重新启动管理器”将导致以下情况之一:
-显示“旧文件正在使用”对话框,要求您关闭对话框中列出的进程。这可能导致您必须通过自定义操作关闭这些进程。
“ RestartManager”和“ FilesInUse”对话框均通过“ InstallValidate”标准操作显示。如果要取消显示这两个对话框,请确保在“ InstallValidate”标准操作之前安排自定义操作。这里有一个陷阱。在InstallValidate之前安排此类自定义操作必须是立即模式自定义操作(在“ IntsallFinalize”之前不能有延迟模式自定义操作)。因此,在没有以管理员身份运行的情况下(例如在启用UAC的情况下),您可能没有关闭应用程序所必需的特权。因此,可能需要重新启动。
-您还可以使用WiX util扩展CloseApplication()函数关闭应用程序。评估您的方案并做适合您的事情。
| 归档时间: |
|
| 查看次数: |
2350 次 |
| 最近记录: |