Getting application config directory folder path
-
I'm working on a Service in C# that will be run on Windows and on Linux. On Linux you store app config in /etc, but on Windows XP it's "C:\Document and Settings\{USERNAME}\Local Settings\Application Data". How would I go about getting those file paths without having to worry about platform detection?
-
I'm working on a Service in C# that will be run on Windows and on Linux. On Linux you store app config in /etc, but on Windows XP it's "C:\Document and Settings\{USERNAME}\Local Settings\Application Data". How would I go about getting those file paths without having to worry about platform detection?
The app.config file is usually in the same folder as the .EXE.
Assembly.GetExecutingAssembly.Location()
will return the full path to the .EXE that is running. You can use thePath
class to get just the path without the .EXE filename and use that to build the complete path to the app.config.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009...