Wix3可以检查服务是否存在?

时间:2011-10-03 16:44:17

标签: service installer wix wix3

Wix 3是否有内置方法来检查服务是否存在?我能想到的最接近的猜测是使用ServiceConfig并尝试检测故障。

1 个答案:

答案 0 :(得分:1)

AppSecInc。社区MSI扩展具有Service_Exists自定义操作 http://msiext.codeplex.com

在线文档:
http://code.dblock.org/Source/msiext/1.2/Docs/_custom_actions_2_system_tools_2_service_impl_8h.html#a6fdcddc7b04a310a368c08726d3be6b3

<Binary Id="SystemTools" SourceFile="$(var.BinDir)\SystemTools.dll" />

<CustomAction Id="SetServiceName" Property="SERVICE_NAME" Value="Service1" />
<CustomAction Id="ServiceExists" BinaryKey="SystemTools" DllEntry="Service_Exists" Execute="immediate" Return="check" />

<InstallExecuteSequence>
     <Custom Action="SetServiceName" After="InstallFiles">NOT Installed</Custom>
     <Custom Action="ServiceExists" After="SetServiceName">NOT Installed</Custom>
</InstallExecuteSequence>

如果服务存在,SERVICE_EXISTS设置为“1”,否则设置为“0”。