I have an Excel file that has a content assembly action in a class library. The library is referenced by both the ASP.NET WebForms application and the console application, and the Excel file is used by both. Is there a way to programmatically get the file path of this file?
I know in ASP, I can do this:
HttpContext.Current.Server.MapPath(@"bin")
And in a console application, I can do this:
Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)
Those work, but I wonder if a better, consolidated way to find the file from the assembly and return the path.
source share