Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows installer 如何使用MSI更新服务_Windows Installer - Fatal编程技术网

Windows installer 如何使用MSI更新服务

Windows installer 如何使用MSI更新服务,windows-installer,Windows Installer,我安装了带有MSI安装程序的windows服务。我试图让这个安装程序充当“更新程序”,首先让它卸载自己(RemovePreviousVersions=true?),然后重新安装自己。我的理解是,如果RemovePreviousVersions=true,当安装程序第二次运行时,它应该注意到产品的当前版本与安装的版本不同,它将对安装的产品执行卸载操作,然后对新版本执行安装操作。然而,情况似乎并非如此。初始卸载步骤似乎从未发生,安装程序只是尝试执行安装。这导致了我的问题,因为安装程序自定义操作是服务

我安装了带有MSI安装程序的windows服务。我试图让这个安装程序充当“更新程序”,首先让它卸载自己(RemovePreviousVersions=true?),然后重新安装自己。我的理解是,如果RemovePreviousVersions=true,当安装程序第二次运行时,它应该注意到产品的当前版本与安装的版本不同,它将对安装的产品执行卸载操作,然后对新版本执行安装操作。然而,情况似乎并非如此。初始卸载步骤似乎从未发生,安装程序只是尝试执行安装。这导致了我的问题,因为安装程序自定义操作是服务安装,当然,服务已经安装,然后抱怨“服务已经存在”

如何让windows installer先卸载,然后再安装服务?也许我对MSI安装程序如何工作的理解是错误的?有更好的安装服务的方法吗?

以下是我的方法

设置升级Id GUID(在安装过程中必须保持不变):


然后在服务器组件标记内:

<ServiceInstall Id='server.exe' Name='...' DisplayName='...' Type='ownProcess'
                Interactive='no' Start='auto' Vital='yes' ErrorControl='normal'
                Account='LocalSystem'
</ServiceInstall>
<ServiceControl Id='server_start' Name='...' Start='install' Wait='yes' />
<ServiceControl Id='server_stop' Name='...' Stop='both' Wait='yes' />
<ServiceControl Id='server_remove' Name='...' Remove='uninstall' Wait='yes' />

在您的执行序列中,您将从何处移除现有产品?基于此,行为会有所不同。请参阅操作说明-

您可以将三个ServiceControl元素组合成一个-
这绝对有用。我忘了提到我们目前没有WIX。我可能需要考虑切换到使用WIX。
<ServiceInstall Id='server.exe' Name='...' DisplayName='...' Type='ownProcess'
                Interactive='no' Start='auto' Vital='yes' ErrorControl='normal'
                Account='LocalSystem'
</ServiceInstall>
<ServiceControl Id='server_start' Name='...' Start='install' Wait='yes' />
<ServiceControl Id='server_stop' Name='...' Stop='both' Wait='yes' />
<ServiceControl Id='server_remove' Name='...' Remove='uninstall' Wait='yes' />
<InstallExecuteSequence>
  <LaunchConditions After='AppSearch' />
  <RemoveExistingProducts After='InstallInitialize' />
</InstallExecuteSequence>