Two of the answers given are correct, but rely on using Windows Forms. If this is not your cup of tea, there are alternatives.
Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName)
and
Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)
source
share