1

I´ve got the following code in my WIX-setup. Now I do want to stop the service, when I install it again.

<Component Id="CMP_Service" Feature="Core" Guid="8926df5e-89b3-47b0-875e-b5c4d14ab0b4">
        <File Source="$(var.Service.TargetPath)" KeyPath="yes">
          <fire:FirewallException Id="ServiceException" Name="Service Exception" Protocol="tcp" Port="[PORTProperty]" Scope="any" />
        </File>
        <ServiceInstall Id="ServiceInstallELS"
          Name="Service"
          Description="Service"
          Start="auto"
          Account="NT AUTHORITY\LocalService"
          ErrorControl="critical"
          Type="ownProcess"
          Vital="yes" Arguments=" /start AtledService" />
        <ServiceControl Id="ServiceControllELS"
          Name="Service"
          Start="install"
          Stop="both"
          Remove="uninstall"
          Wait="yes" />
      </Component>
Felix Arnold
  • 839
  • 7
  • 35
  • What happens when you run this version of your code? – Stein Åsmul Apr 14 '21 at 16:42
  • @SteinÅsmul It installs the service but if the service is already installed and running, the new version is not installed – Felix Arnold Apr 15 '21 at 13:29
  • There might be something else wrong here, is your source on github.com? Some samples here: [Robs79](https://github.com/Robs79/How-to-create-a-Windows-Service-MSI-Installer-Using-WiX), [Klein](https://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/), [Painter](https://github.com/iswix-llc/iswix-tutorials), [Stropek](https://github.com/rstropek/Samples/tree/master/WiXSamples/WindowsService). Maybe try with a test service binary with minimal WiX parameters set to get a feel for how things work, and to reveal any bugs in your own executables. – Stein Åsmul Apr 15 '21 at 14:47
  • Keep component GUIDs stable across releases, set a key path properly, set only minimal parameters for testing, use a proper test service binary to eliminate that error source, check upgrade scenarios and uninstall, keep Ids and names stable to ensure that service control commands make it to the right service binary. That kind of stuff must be tested. – Stein Åsmul Apr 15 '21 at 14:55

0 Answers0