C# – Getting the application’s directory from a WPF application

cnetwpf

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

Best Answer

One method:

System.AppDomain.CurrentDomain.BaseDirectory

Another way to do it would be:

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