Launching WorkerService(.exe) from WPF Project's Output Folder Issue

22 Views Asked by At

Launching a dependent WorkerService .exe from a WPF project folder throws an error in WorkerService.exe:

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.EventLog, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.Diagnostics.EventLog, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Microsoft.Extensions.Logging.EventLog.EventLogLogger..ctor(String name, EventLogSettings settings, IExternalScopeProvider externalScopeProvider)
...and so on

The projects are default and empty, and there's nothing to look at.

solution structure

WPF output folder:

WPF proj output

console output


However, launching the same exe from the regular console application(ConsoleServiceStarter) project folder happens without any issues.


Installing Microsoft.Extensions.Hosting in a WPF project doesn't change anything. Manually copying the output files from SimpleWorkerService to WpfServiceStarter certainly solves the problem.

What needs to be configured to fix this?

0

There are 0 best solutions below