I have been looking for a long time, but the topic seems pretty special. I didn’t come up with anything. Maybe experts can help here.
I start a Windows service that accesses some databases and does some calculations. If something fails, it will write to the log file. My desire is to separate these notes. This worked great with every project except this windows service.
I use resource manager and localized resource files. At runtime, CultureInfo changes:
Thread.CurrentThread.CurrentUICulture = new CultureInfo(this.language);
where language is the value read from the configuration file. Changes will be fixed on the following line:
LogService.WriteEntry(CultureInfo.CurrentUICulture.Name, EventLogEntryType.Information);
This works and returns the correct CultureInfo. The resource files are named correctly, but still the local file (in this case "de") is not available, and the default file (English) is used. I added resource files to the project in the installation project.
Edit: In other projects, the following worked fine, but not for the Windows service:
ResourceManager locRM = new ResourceManager("WindowsService.ResWindowsService", Assembly.GetExecutingAssembly());
It seems that the Windows service simply cannot find the satellite assembly, and then returns to the neutral resource file, which seems to be in the Windows Service exe file. Does anyone know how I can get Windows Service to find a satellite assembly.
Edit 2: SOLUTION
My dear colleague helped me. I strongly called the satellite assembly and registered it with the GAC. That was the solution. Windows Service can now access it. Detailed instructions: In the file system editor of the installation project: Add a special folder → Global assembly cache folder. Add a file → I added a resource file here Then in the section Project Properties → Sign Sign “Sign the assembly” and create a new key file.
What is it.
Thanks Nils