What is the best method of getting the path the C# executable is running from?
I need to use it for temp folders etc and currently I\'m using:
Path.G
IHostEnvironment.ContentRootPath
.IHostingEnvironment.ContentRootPath
(obsolete since Core 3.0).Personally I find that these are what I generally need: the place where included content is located.
I can confirm that IHostEnvironment.ContentRootPath
also returns the desired result when running as a unit test. (Tested with xUnit, but the test framework should not matter.)
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)