Gets the absolute path of the executing assembly in C# dotnet.

public static string GetAppPath()
{
    Module[] modules = Assembly.GetExecutingAssembly().GetModules();
    string location = System.IO.Path.GetDirectoryName(modules[0].FullyQualifiedName);

    return location;
}