[英]wix: re-start an existing Service when install/uninstall finish
當我的安裝程序完成安裝或卸載后,我想重新啟動正在運行的服務。
我找到了以下代碼:
<ServiceControl Id="SomeUniqueId" Name="NameOfTheirService"
Start="both" Stop="both"/>
但是我要將這段代碼附加到哪里? 到放置我的組件?
碼:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="325c4bfd-6614-43e9-aedb-93661295352d" Name="Plugin" Language="1033" Version="1.0.0.0"
Manufacturer="XXX Inc." UpgradeCode="4307526e-3902-40d0-991b-bacff9b3d71b">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Property Id="XXXXXX">
<RegistrySearch Id="XXXXXX" Type="raw"
Root="HKLM" Key="SOFTWARE\XXX\XXX" Name="InstallationPath" />
</Property>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="XXXXXX">
<Component Id="ProductComponent" Guid="93118c45-f0c0-4c9e-9168-8ea905e9427c">
<File Id="pluggin" Source="C://setup.log" KeyPath="yes" Checksum="yes"/>
<ServiceControl Id="StartService" Name="servicename"
Start="both" Stop="both"/>
</Component>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="install" Level="1">
<ComponentRef Id="ProductComponent" />
<ComponentGroupRef Id="Product.Generated" />
</Feature>
</Product>
必須將ServiceControl
元素放置在您安裝的組件中。 從WiX .chm:
啟動,停止和刪除父組件的服務。 此元素用於通過使用開始,停止和刪除屬性來控制由MSI或MSM文件安裝的服務的狀態。 例如,Start ='install'Stop ='both'Remove ='uninstall'表示:在安裝時啟動服務,在卸載產品時刪除服務,並在安裝和卸載時均停止服務。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.