Can anyone tell me what's the difference between System.CurrentDomain.AppDomain.BaseDirectory
and Directory.GetCurrentDirectory()
in C#, please??
See AppDomain on MSDN and also Directory.GetCurrentDirectory() on MSDN.
According to this question the difference is that
System.AppDomain.CurrentDomain.BaseDirectory returns current directory, not executable location, i.e. when run from outlook (sent as a link to \server\folder\file.exe it will set BaseDirectory to user documents instead executable location from Jakub Pawlinski whereas
Directory.GetParent(Assembly.GetExecutingAssembly().Location)
gets the parent folder of the current execting assembly.
So the code I'm using now is:
string location = Assembly.GetExecutingAssembly().Location;
if (location != null)
{
string config = Path.Combine(Directory.GetParent(location).FullName, "Config.xml"));
}