What is the best way to determine application root directory?

AppDomain.CurrentDomain.BaseDirectory is my go to way of doing so.

However:

Application.StartupPath gets the directory of your executable

AppDomain.BaseDirectory gets the directory used to resolve assemblies

Since they can be different, perhaps you want to use Application.StartupPath, unless you care about assembly resolution.

Leave a Comment