title: C# .NET5 Single File Application Read and Parse Json / Txt or other file formats from directory
body: <p>I am reading files on .NET Framework like this:</p>
  <pre><code>string path = AppDomain.CurrentDomain.BaseDirectory + @&quot;sources\settings.json&quot;;
  string jsonResult = File.ReadAllText(path);
  return JsonConvert.DeserializeObject&lt;Settings&gt;(jsonResult);
  </code></pre>
  <p>When I switch to .NET5 this only works on Debug mode. When I create a <code>Single File Executable</code> using <strong>Publish</strong> it is not running. When U click the Exe it never open or throws an exception. Also, <code>try-catch</code> block couldn't handle the exception.</p>
  <p>Publish settings:
  <a href="https://i.stack.imgur.com/SjPwI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SjPwI.png" alt="publish settings" /></a></p>
  <p>How can I make this work on .NET5 Single Exe files?</p>