WiX - Restart service after modification of the installed product

I'm writing a MSI which installs a windows service and adds some DLLs which the service uses. Those DLLs are features which can be added or removed using the installer.

After a user modifies the installed product(eq. add a new feature), windows service needs to be restarted. Is there a more elegant way of doing so in WiX 3.5 other than calling a custom action which would restart the service?

This is how I'm starting the service.

<ServiceControl Id="StartService" Name="MyService" Start="install" Stop="both" Remove="uninstall" Wait="yes" />

EDIT: Here's the complete component code. Disregard the ids.

<Component Id="MyService" Guid="GUID"> <File Id="MyService" Source="$(var.BuildDestination)/$(var.NameSpacePrefix).MyService.exe" KeyPath="yes" > </File> <RemoveFile Id='AppConfigFile' On='uninstall' Name='MyService.exe.Config' /> <User xmlns="http://schemas.microsoft.com/wix/UtilExtension" Id="ServiceAccount" CreateUser="no" FailIfExists="no" RemoveOnUninstall="no" UpdateIfExists="yes" Disabled="no" LogonAsService="yes" Name="[ACCOUNT]" Password="[PASSWORD]" /> <ServiceInstall Id="MyService" Type="ownProcess" Vital="yes" Name="MyService" DisplayName="MyService" Description="MyService" Start="auto" Account="[ACCOUNT]" Password="[PASSWORD]" ErrorControl="ignore" Interactive="no"> </ServiceInstall> <ServiceControl Id="StartService" Name="MyService" Start="install" Stop="both" Remove="both" Wait="yes" > </ServiceControl>


As the state of the service feature(feature which installs and starts the service) wasn't updated, the service itself wasn't stopped and started too. I've solved the issue by adding ServiceControl to all components which are separate features.

<Component Id="Modules1" Guid="GUID"> <File Id="Modules.1" Source="$(var.BuildDestination)/$(var.NameSpacePrefix)Modules.1.dll" KeyPath="yes"> </File> <ServiceControl Id="StartService1" Name="MyService" Start="install" Stop="both" Wait="yes" > </ServiceControl>


This solution works for me:

<Component Directory="APPLICATIONFOLDER"> <File Source ="MyService.exe" KeyPath ="yes" /> <ServiceInstall Id ="MyService.exe" Name ="My Service" Account ="LocalSystem" Start ="auto" ErrorControl="normal" Interactive ="no" Type ="ownProcess" Description ="My service does stuff."/> <ServiceControl Id ="MyService.exe" Name ="My Service" Start ="install" Stop ="both" Remove ="both" Wait ="no"/> </Component>


  • How to restart IIS from WIX?
  • Installed a plugin on eclipse (mars), now eclipse won't start. How can I uninstall the plugin?
  • Use double quote then curly brace in powershell -Command
  • Bundler using old version
  • Paramiko SSHException Channel Closed
  • Parallel sieve of Eratosthenes - Java Multithreading
  • How can I tell a form not to dispose a particular control when it closes?
  • Multiple producers single consumer locking schema
  • OSX - always hide certain files
  • Compiling dlib on OS X
  • SonarQube: Cannot deactivate rule with missing quality profile
  • npm 5.4.1 install/uninstall all failing
  • How to generate and display a QR Code in ionic 2
  • Code in Job's Script Block after Start-Process Does not Execute
  • With Hadoop, can I create a tasktracker on a machine that isn't running a datanode?
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Regex thinks I'm nesting, but I'm not
  • What is the “return” in scheme?
  • Fetching methods from BroadcastReceiver to update UI
  • Trying to switch camera back to front but getting exception
  • Symfony2: How to get request parameter
  • GridView Sorting works once only
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How to disable jQuery.jplayer autoplay?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • WPF Applying a trigger on binding failure
  • Proper way to use connect-multiparty with express.js?
  • Trying to get generic when generic is not available
  • embed rChart in Markdown
  • How to stop GridView from loading again when I press back button?
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal