Search code examples
.net-corewixwindows-services

'System.ServiceProcess.ServiceController version issue with Wix Installer and .Net Core 3.1


I get an exception "Could not load file or assembly 'System.ServiceProcess.ServiceController, Version=4.2.3.0" when trying to install a Windows Service written in .Net Core 3.1 using Wix 3.11.2. The version of System.ServiceProcess.ServiceController.dll on my system is 4.7.19.56404. I've added the ..\netcoreapp3.1\runtimes\win\lib\netstandard2.0 directory per one suggestion and also enabled AutoGenerateBindingRedirects and GenerateBindingRedirectsOutputType in the project file. How to work around this binding issue?


Solution

  • I resolved the problem by first using publish to generate the output files, and then added them as components to my Product.wxs file. Then the service installed and ran fine. It was a lot of files so I wrote a small console app to generate the component XML to a file and pasted that into the Product.wxs file.

    Initially, I was taking the files from the folder upstream from the publish folder. I may also have overlooked a file as well because I was adding them manually.