There are many ways of getting application folder. Some are good some are bad. But the main difference between those methods is that some are constant and some are changeable. I will sort four methods in order from best to worse: AppDomain.CurrentDomain.BaseDirectory (best) Application.StartupDirectory good but requires System.Windows.Forms Environment.CurrentDirectory (bad because you can't be sure that always will return the same folder path)
also reflection can be used 'this.GetType.Assembly.Location' to get current directory, but mainly it is used for getting running directory of some library.
|