What is the best way to get the executing exe's path in .NET?
I usually access the directory that contains my application's .exe with:
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
string exePath = Application.ExecutablePath;
string startupPath = Application.StartupPath;
EDIT - Without using application object:
string path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );
See here for more info:
http://msdn.microsoft.com/en-us/library/aa457089.aspx
Application.ExecutablePath
Application.StartupPath