I have a Windows service that runs as a specific user (agent installed on desktop machines) - I had originally stored/updated appsettings.json
in Program Files
alongside the binary, but this causes issues during updates etc.
I have since moved to using an app config file under the users home directory - which I create manually (Finding local users profile path in C# and creation of folder).
I also see there is a ProgramData
enum that is available via .NET directory enums, and would save the above code (less things to break in future).
The Linux/MacOS version of this software would be under /home/myuser
or /etc/myapp
. I need to consider this as I write an abstraction layer to run my BackgroundWorker
as a daemon and the associated installation thereof.
My question is which is better to follow for this multi-platform supported app, store config files by user directory, or program data directory?
Appreciate this is on the fringes of development question, but also not necessarily serverfault question - if better suited let me know and will repost on a different site.