Getting the application's directory from a WPF application

Joey picture Joey · Jun 2, 2009 · Viewed 193.4k times · Source

I found solutions for Windows Forms with AppDomain but what would be the equivalent for a WPF Application object?

Answer

Helen picture Helen · Jun 2, 2009

One method:

System.AppDomain.CurrentDomain.BaseDirectory

Another way to do it would be:

System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)