title: How to get the solution path in c#
body: <p>I need to get the path where the solution file (.sln) is located. I try with this lines:</p>
  <pre><code>string startupPath = Path.Combine(Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName,&quot;abc.txt&quot;);
  
  // Read the file as one string. 
  string text = System.IO.File.ReadAllText(startupPath);
  </code></pre>
  <p>When I run it, I get an &quot;Unauthorized Access Exception&quot;. When I put the path &quot;manually&quot;: <code>C:\Users\yabej\source\repos\tutoriales\Proyecto 0.1</code> it works!</p>
  <p>However I need an &quot;automatic&quot; solution to be sure that the path will be correct when I run my project on different computers</p>