There are several methods, but some of them give different results depending on how the application is hosted and other factors, other requires additional references. What you need is the location of the main executable module of the entry assembly.
This is the robust and universal way:
string applicationLocation = System.Reflection.Assembly.GetEntryAssembly().Location;
string applicationDirectory = System.Path.GetDirectoryName(applicationLocation);
Of course, one can use any other assembly of the application, but in some cases its directory might differ from the entry assembly. There are cases when you need that different directory. For example, the location of executing assembly.
This is the way applicable only to a Forms application:
using System.Windows.Forms;
string applicationDirectory = Application.ExecutablePath;
—SA