I have a Windows service that should look for a configuration file in its current directory.
So I use directory.getcurrentdirectiry() but instead of the
directory.getcurrentdirectiry()
Getting directory from full path:
var location = System.Reflection.Assembly.GetEntryAssembly().Location; var directoryPath = Path.GetDirectoryName(location);
Quite a silly problem when comparing to writing a Windows service :)