我在重大升级时遇到了问题.安装程序包含一项服务,在升级时我得到一个弹出窗口,说明需要重新启动才能完成安装过程.
为了防止这种行为,我实际上只需要在执行RemoveExistingProducts
(而不是InstallValidate
)之前停止服务.
在MajorUpgrade
放置后InstallInitialize
和所述封装具有InstallPrivileges="elevated"
.
我有两个案例:
案例1:服务由ServiceInstall
via 安装
<Component Id="myservice_Service" Guid="*">
<File Id="myservice.exe" KeyPath="yes" Vital="yes"
Source="SourceDir\bin\myservice.exe"/>
<ServiceInstall Id="myservice_ServiceInstall" Type="ownProcess"
Vital="yes" Name="myservice" DisplayName="myservice Service"
Description="myservice Service" Start="auto" Account=".\LocalSystem"
ErrorControl="ignore" Interactive="no" Arguments="--run"/>
<ServiceControl Id="myservice_ServiceControl" Name="myservice" Wait="yes" Stop="uninstall"/>
</Component>
Run Code Online (Sandbox Code Playgroud)
在ServiceControl
不停止服务之前InstallValidate
被调用.即使说Stop ="both".所以弹出窗口出现了.请注意,安装程序不会启动该服务.
我发现的合理帖子(摘录):
案例2:服务由a安装CustomAction
(有一些原因,为什么不做通过ServiceInstall
).在这种情况下,我必须调用可执行文件来停止服务("myservice.exe --stop").为此,它变得棘手,因为由于ICE63,不允许调度CustomAction
之前RemoveExistingProducts
调用.那么,我怎么能实现这个呢?
到目前为止,我已阅读过以下帖子:
bootstrapper exe是没有选择的,因为我需要生成一个普通的MSI.
我在这里找到了类似的未解答的问题:Wix安装程序问题:为什么RestartManager将服务标记为RMCritical而不是RMService
我使用 Visual Studio 2008 开发了一个 Windows 服务和一个安装项目。当我进行升级安装时,我收到以下警告:
以下应用程序正在使用安装程序必须更新的文件。您可以关闭应用程序并单击“再试一次”,或单击“继续”以便安装程序继续安装,并在系统重新启动时替换这些文件。
我想在升级安装过程中停止 Windows 服务。我已尝试创建自定义操作并覆盖 OnBeforeInstall 方法,但是在警告弹出消息已经发生后调用此方法为时已晚。
作为 msi 安装程序的一部分,有什么方法可以实现这一点。在执行 msi 安装程序之前,我宁愿不必将此作为单独的任务来执行。
更新:
根据进一步的研究,我发现 MSI 数据库确实支持这一点,但是内置的 Visual Studio 安装程序(设置)项目不提供执行此操作的方法。必须调整 MSI 数据库,或者使用 WiX 或商业安装程序。