title: Original assembly location in .NET 5.0 Linux with Single-File Executable
body: <p>I've found numerous answers relating to .NET Core 3.1 and .NET 5.0 on <em>Windows</em>, but so far have been unable to find how to get the original assembly location under .NET Core on <em>Linux</em> when using a single-file executable.  Given that the systems behave differently, I think this is probably a bug in .NET 5, but I need a workaround in the mean time.  Note that in my scenario, the current directory is <em>not</em> where the original executable is located, even if I don't change it, and I have no control over it (and that's a hack anyway--the purpose of current directory is <em>completely</em> different).  Here's the actual output of a test program under this scenario with the properties and functions that have been suggested in all the other posts I've been able to find so far:</p>
  <pre><code>Directory.CurrentDirectory()=/home/ec2-user/source
  typeof(Program).Assembly.Location=/root/.net/Test/jwaxs3pc.bdp/Test.dll
  typeof(Program).Assembly.GetFiles() [0].Name=/root/.net/Test/jwaxs3pc.bdp/Test.dll
  typeof(Program).Assembly.GetName().CodeBase=file:///root/.net/Test/jwaxs3pc.bdp/Test.dll
  AppContext.BaseDirectory=/root/.net/Test/jwaxs3pc.bdp/
  Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName=/root/.net/Test/jwaxs3pc.bdp
  </code></pre>
  <p>I need to find the <em>original</em> code location, not the location the single-file executable was decompressed into.  How do I get this most basic of all information?  Is there not a platform and setting-independent way to do this (there <em>really</em> should be)?</p>