如何在wix中停止对.exe的修复,更新和删除? [英] How can I stop an .exe on repair, update and delete in wix?

查看:62
本文介绍了如何在wix中停止对.exe的修复,更新和删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的wix中,我使用以下声明:

In my wix I use the following declaration:

<ComponentGroup Id="BinComponents" Directory="BIN">
  <Component Id="BinComponent" Guid="23D229D0-06EE-49f4-80B4-6D7136500721">

    <File Id="MyProjectOutput" Name="MyProject.exe" Source="MyProject\bin\MyProject.exe"/>
    <ServiceControl Id="RemoveService"
       Stop="both"
       Remove="both"
       Name="MyProject.exe"
       Wait="yes" /> <!-- Stop running MyProject instances -->

  </Component>
</ComponentGroup>


我的副本:

首先,我像往常一样运行安装.安装后,我启动我的Web应用程序..exe照常出现在任务管理器中:

At first, I run my installation as usual. After the installation, I start my web application. An .exe appears in the task manager as usual:

我想在维修,更新或卸载时结束此.exe.因此,我再次启动.msi并选择修复":

I want to end this .exe on a repair, update or uninstall. So I start my .msi again and choose repair:

现在是我的问题:在按下修复"后,由于声明了 ServiceControl ,我希望出现以下对话框:

Now my problem: After pressing 'Repair', I expect the following dialog because of the declared ServiceControl:

但事实并非如此.而是显示以下对话框:

But it doesn´t. Instead, the following dialog appears:

当我记录设置时,日志显示以下几行:

When I log the setup, the log shows the following lines:

MSI (s) (A8:DC) [10:16:28:227]: Executing op: ActionStart(Name=StopServices,Description=Stopping services,Template=Service: [1])
Action 10:16:28: StopServices. Stopping services
MSI (s) (A8:DC) [10:16:28:228]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (A8:DC) [10:16:28:228]: Executing op: ServiceControl(,Name=MyProject.exe,Action=2,Wait=1,)
MSI (s) (A8:DC) [10:16:28:228]: Executing op: ActionStart(Name=DeleteServices,Description=Deleting services,Template=Service: [1])
Action 10:16:28: DeleteServices. Deleting services
MSI (s) (A8:DC) [10:16:28:228]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (A8:DC) [10:16:28:229]: Executing op: ServiceControl(,Name=MyProject.exe,Action=8,Wait=1,)
MSI (s) (A8:DC) [10:16:28:229]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: 
[1],  Directory: [9],  Size: [6])

[...]

MSI (s) (7C:28) [09:06:21:950]: RESTART MANAGER: Did detect that a critical application holds file[s] in use, so a reboot will be necessary.
MSI (s) (7C:28) [09:06:21:950]: Note: 1: 1610 
MSI (s) (7C:28) [09:06:21:950]: Note: 1: 2205 2:  3: Error 
MSI (s) (7C:28) [09:06:21:950]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1610 

在维修旁边,我还尝试了一次更新,其结果相同.也许缺少任何声明?注意:当我在任务管理器中关闭MyApp.exe时,该消息不会出现,因此MyApp.exe绝对是造成此问题的原因.

Next to a Repair I also have tried an Update with the same results. Perhaps any declaration missing? Note: When I close the MyApp.exe in the task manager, the message does not appear, so the MyApp.exe is definitely responsible for the problem.

推荐答案

您看到的警告对话框来自"InstallValidate"标准操作.过去我也遇到过类似的问题.我通过针对相同的服务ID 使用单个服务控制元素而不是多个服务控制元素来解决此问题.就我而言,我有多个服务控制元素用于同一个服务ID.

The warning dialog that you are seeing is from "InstallValidate" standard action. I have run into a similar issue in the past . I fixed it by making use of a single service control element instead of multiple service control elements, for the same service id. In my case, i had multiple service control elements for the same service id.

这是根据位于的链接 http://Windows-installer-xml-wix-toolset.687559.n2.nabble.com/Upgrade-uninstall-restart-issue-td7586315.html

这帮了我大忙.尽管没有正式记录,但许多用户都报告了相同的行为.具有单个服务控制元素会使Restart Manager注意到Service Control表中的条目,并且将阻止Restart Manager在RMFilesInUse对话框中列出该服务,或者将阻止Restart Manager.引发警告消息,通知用户可能需要重新启动.这是另外一个链接无法使用WiX启动Windows服务

This did the trick for me. Numerous users have reported the same behavior, though its not officially documented. Having a single service control element makes Restart Manager take note of the entry in the Service Control table and will prevent Restart Manager from listing the service in the RMFilesInUse dialog box or will prevent Restart Manager from throwing up warning messages informing the user that a restart might be required. Here is one more link Can't start windows service with WiX

我的实验告诉我,服务控制元素的数量与Restart Manager之间存在definitley链接. http://microsoft.public.windows.msi.narkive.com/OOuQQAsw/control-restart-manager-behaviour

My experiments have shown me that there is definitley a link between the number of service control elements and Restart Manager http://microsoft.public.windows.msi.narkive.com/OOuQQAsw/controlling-restart-manager-behaviour

另一种选择是使用属性RESTARTMANAGERCONTROL完全禁用Restart Manager,以防禁用RestartManager,系统可能会提示您重新引导(您可能需要对其进行一次测试),然后启动使用中的文件"机制离开.有关的msi开发人员有意识地决定禁用重新启动管理器,有时这是必要的.

The other option was to totally disable Restart Manager using the property RESTARTMANAGERCONTROL, In case, you disable the RestartManager, you might be prompted for reboots(you might want to test it once) and the legacy "Files in Use" mechanism kicks off. Disabling Restart Manager is a conscious decision by the concerned msi developer and at times becomes necessary.

我不确定您的服务控制表的外观.只是想与您分享我的经验.

I am not sure about how your Service Control table looks like. Just wanted to share my experience with you.

希望这会有所帮助.

关于,克兰·黑格(Kiran Hegde)

Regards, Kiran Hegde

这篇关于如何在wix中停止对.exe的修复,更新和删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆