0

Here is my .wxs file contents:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <Package Name="__PRODUCT_NAME__" Language="1033" Version="__VERSION__" Manufacturer="USCIS"
    UpgradeCode="__UPGRADE_CODE_GUID__"
    InstallerVersion="500" Compressed="yes"
    Scope="perMachine">
    <MajorUpgrade AllowDowngrades="yes" Schedule="afterInstallInitialize" />
    <MediaTemplate EmbedCab="yes" />
    <Property Id="ARPCOMMENTS" Value="__COMMENT__" />
    <Feature Id="ProductFeature" Title="Main Application" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
  </Package>
  <Fragment>
    <Directory Id="ManufacturerFolder" Name="MyCompany">
      <Directory Id="INSTALLFOLDER" Name="MyApp" />
    </Directory>
  </Fragment>
  <Fragment> 
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Files Include="Output\**\*">
        <Exclude Files="Output\MyAppService.exe" />
      </Files>
      <Component Id="ServiceComponent" Guid="*" Bitness="always64">
        <!-- Install the executable file -->
        <File Id="File_MyAppServiceExe" Source="Output\MyAppService.exe" KeyPath="yes" />
        <!-- Install the service -->
        <ServiceInstall
          Id="ServiceInstaller"
          Type="ownProcess"
          Name="MyAppService"
          DisplayName="My App Service"
          Description="Peforms important service"
          Start="auto"
          ErrorControl="normal"
          Account="LocalSystem"
          Vital="yes"/>
        <!-- Control the service -->
        <ServiceControl
          Id="StartService"
          Name="MyAppService"
          Start="install"
          Stop="both"
          Remove="uninstall"
          Wait="yes" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

When running the installer, the files are copied to the install folder, the registry entry is created, and the service installs and starts without issues. However, on uninstall, the service is not stopped or removed. The service can be created, started, stopped, and removed without issue using sc.exe.

The underlying application is a .NET 8 BackgroundService Worker.

Any ideas?

1
  • Always, always, always start with the verbose log file. Commented 14 hours ago

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.