With the new release of .NET Core 3, I am trying to make a windows service with the new worker service template. I need to be able to install this with group policy, and WiX seems to be the tool for the job.
I've created the .wxs file and without specifying the ServiceInstall section, it installs fine.
Here's my file: UPDATED
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SystemInformationService" Language="1033" Version="1.0.0.0" Manufacturer="MyCompany" UpgradeCode="f08191cf-461e-481b-a2a1-6f54d6ae5331">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- Embed cab files, don't include them in the output -->
<MediaTemplate EmbedCab="yes"/>
<!-- Default WiX dialog set -->
<UIRef Id="WixUI_Mondo" />
<!-- License agreement -->
<WixVariable Id="WixUILicenseRtf" Value="LicenseAgreement.rtf" />
<Feature Id="ProductFeature" Title="SystemInformationService.Setup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="HeatGenerated" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SystemInformationService" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent" Guid="5BB7300D-C29F-4C87-B461-AAE3AA4EB56D">
<CreateFolder/>
<!--<File Source="$(var.SystemInformationService.TargetPath)" />-->
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Name="SystemInformationService"
DisplayName="System Information Service"
Description="System Information service by MyCompany"
Start="auto"
Vital="no"
Account="LocalSystem"
Interactive="no"
ErrorControl="normal" />
<ServiceControl
Id="ServiceInstaller"
Start="install"
Stop="both"
Remove="uninstall"
Name="SystemInformationService"
Wait="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Now I'm trying to add the service components so that it will start on install. When I run the installer after adding it, the installer UI hangs on 'Starting Service...'. I tried adding the 'start' arguments since I saw that on another answer.
I'm thinking since this is .net core, I might need to add an action .exe or something to start the service. That's all I can think of - any suggestions will help.
Thanks
UPDATE: I've updated the .wxs file to what I now have, and I have it correctly installing with a framework dependent deployment. My problem was specifying AnyCPU instead of x86. But... Now when I switch to a self-contained deployment I get the same error as before. So It must be something to do with how I'm publishing the .net core.
This is my publish profile currently. When i switch to framework dependent the installer runs fine and starts the service.