title: How to get file path of content in class library
body: <p>I have an Excel file that has a Build Action of <code>content</code> in a class library. The library is referenced by both an ASP.NET WebForms application and a console application, and the Excel file is used by both. Is there a way I can programmatically get the file path of this file?</p>
  
  <p>I know in ASP I can do this:</p>
  
  <pre><code>HttpContext.Current.Server.MapPath(@"bin")
  </code></pre>
  
  <p>And in the console app I can do this:</p>
  
  <pre><code>Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)
  </code></pre>
  
  <p>Those work, but I'm wondering if there's better, consolidated way to find the file from the assembly and return the path.</p>