I see that there are some ways to get the application folder path:
Application.StartupPath
System.IO.Path.GetDirectoryName(
System.
In my experience, the best way is a combination of these.
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase
Will give you the bin folderDirectory.GetCurrentDirectory()
Works fine on .Net Core but not .Net and will give you the root directory of the projectSystem.AppContext.BaseDirectory
and AppDomain.CurrentDomain.BaseDirectory
Works fine in .Net but not .Net core and will give you the root directory of the projectIn a class library that is supposed to target.Net and .Net core I check which framework is hosting the library and pick one or the other.