c# - wix: Service is not being started after rollback -


we have wix project. installs 2 windows services , windows desktop application shown in task bar tray icon. purpose of these 2 services watch each other , desktop application if 1 of service not running, other service start it. , if desktop application not running, 1 of 2 services start desktop application.

we want implement rollback feature in our installer if there error during upgrade latest version, installer rollback previous existing version. testing rollback using wixfailwhendeferred.

<customactionref id="wixfailwhendeferred" /> 

the rollback seems work in tests, install rollbacks previous versions. example, in machine v8.0.1.0 installed , when run following command, tries install v8.0.2.0 rollbacks 8.0.1.0.

>msiexec.exe /passive /norestart /i "d:\setup8.0.2.0.msi" /l*vx+ "d:\test\installlog8.0.2.0.log"   wixfailwhendeferred=1 
  1. but, have 1 issue. if 8.0.1.0 installed in machine , double click newer version 8.0.2.0.msi, ask close existing desktop application. mean, shows file in use dialog box.
  2. in above command line, if remove /passive argument, shows file in use dialog box.
  3. also, service not being started after rollback.
  4. so, missing in our wix project?

the wix code

 <majorupgrade schedule="afterinstallinitialize" downgradeerrormessage="a newer version of [productname] installed." /> 

the custom actions

 <customaction id="certificateinstallcustomaction"               binarykey="certificatecustomactions.ca.dll"               dllentry="installclientcertificate"               execute="deferred"               return="check"                impersonate="no" />  <customaction id="certificateremovecustomaction"               binarykey="certificatecustomactions.ca.dll"               dllentry="uninstallclientcertificate"               execute="deferred"               return="check"               impersonate="no"/>  <customaction id="clientinstallcustomaction"               binarykey="clientcustomactions.ca.dll"               dllentry="installvalidation"               execute="deferred"               return="check"                impersonate="no"/>      <customaction id="clientinstallcustomactionroll"               binarykey="clientcustomactions.ca.dll"               dllentry="installvalidation"               execute="rollback"               return="ignore" />    <customaction id="clientremovecustomaction"               binarykey="clientcustomactions.ca.dll"               dllentry="uninstallvalidation"               execute="immediate"               return="check"/>  <customaction id="startserviceifnotrunningidroll"               binarykey="clientcustomactions.ca.dll"               dllentry="startserviceifnotrunning"               execute="rollback"               return="ignore" /> 

clientremovecustomaction: custom action kill desktop application before uninstallation.

the sequence

<customaction  id='alreadyinstalled' error='you running same version of [productname] trying install.' /> <customactionref id="wixfailwhendeferred" />  <installexecutesequence>   <!--<removeexistingproducts after="installinitialize" />-->   <custom action='alreadyinstalled' after='findrelatedproducts'>same_version_installed</custom>    <custom action="certificateinstallcustomaction" after="installservices">     (not installed) , (not upgradingproductcode) <!-- install -->   </custom>   <custom action="certificateremovecustomaction" after="certificateinstallcustomaction">     (not upgradingproductcode) , (remove="all") <!-- unintall-->   </custom>   <custom action="clientinstallcustomaction" before="certificateinstallcustomaction" >     (not installed) , (not upgradingproductcode) or (not installed)<!-- install-->   </custom>   <custom action="clientinstallcustomactionroll" before="clientinstallcustomaction" >     (installed or not installed)   </custom>   <custom action='clientremovecustomaction' before='installvalidate'>     (not upgradingproductcode) , (remove="all") or (remove) <!--  unintall , upgrade, need ask uninstall password-->   </custom>   <custom action='startserviceifnotrunningidroll' after='installinitialize'>    (installed)  <!--this restart service in case of rollback.-->    </custom> </installexecutesequence> 

the services

<componentgroup id="clientservices" directory="installfolder">   <component id="abcwd.exe" guid="*">     <file id="abcwd.exe" keypath="yes" source="$(var.clientsourcedirectory)\abcwd.exe" />     <wix:serviceinstall id="abcwdserviceinstaller" type="ownprocess" name="service1" displayname="service1"                          description="enforces enterprise instant messaging policy." start="auto" errorcontrol="normal" interactive="no" vital="yes" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/netfxextension" xmlns:util="http://schemas.microsoft.com/wix/utilextension">       <wix:serviceconfig delayedautostart="yes" oninstall="yes" onreinstall="yes" onuninstall="no"/>       <util:serviceconfig firstfailureactiontype="restart" secondfailureactiontype="restart" thirdfailureactiontype="restart" restartservicedelayinseconds="60" resetperiodindays="1" />     </wix:serviceinstall>     <wix:servicecontrol id="abcwdstartservice" start="install" stop="both" remove="uninstall" name="abcwd" wait="yes" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/netfxextension" xmlns:util="http://schemas.microsoft.com/wix/utilextension" />    </component>    <component id="sysabcmon.exe" guid="*">     <file id="sysabcmon.exe" keypath="yes" source="$(var.clientsourcedirectory)\sysabcmon.exe" />     <wix:serviceinstall id="sysabcmonserviceinstaller" type="ownprocess" name="service2" displayname="service2"                          description="enforces enterprise instant messaging policy." start="auto" errorcontrol="normal" interactive="no" vital="yes" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/netfxextension" xmlns:util="http://schemas.microsoft.com/wix/utilextension">       <wix:serviceconfig delayedautostart="yes" oninstall="yes" onreinstall="yes" onuninstall="no"/>       <util:serviceconfig  firstfailureactiontype="restart" secondfailureactiontype="restart" thirdfailureactiontype="restart" restartservicedelayinseconds="60" resetperiodindays="1" />     </wix:serviceinstall>     <wix:servicecontrol id="sysabcmonstartservice" start="install" stop="both" remove="uninstall" name="sysabcmon" wait="yes" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/netfxextension" xmlns:util="http://schemas.microsoft.com/wix/utilextension" />   </component> </componentgroup> 

actually, got solution after hit , trial. in order prevent file in use ( or prevent close application prompt), have add condition remove ca clientremovecustomaction - kills desktop application.

 <custom action='clientremovecustomaction' before='installvalidate'> (not upgradingproductcode) , (remove="all") or (remove) <!--  unintall     , upgrade, need ask uninstall password--> </custom> 

when rollback done, service not started have add following custom action start service in case of rollback. need understand ca should sequenced possible executed @ last in rollback.

<custom action='startserviceifnotrunningidroll' after='installinitialize'>  (installed)  <!--this restart service in case of rollback.-->  </custom> 

please let me know if there better solution.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -