title: C# How to get current directory path
body: <p>Scenario :
  I've created a library project which provides interface to installer(exe created using install shield).I want to check whether a particular file exists in the installer folder.</p>
  
  <p>I've tried following :</p>
  
  <pre><code>1).  Assembly.GetEntryAssembly().Location
  </code></pre>
  
  <blockquote>
    <p>// Throws "Object reference not set to an instance of an object"</p>
  </blockquote>
  
  <pre><code>2). new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath
  </code></pre>
  
  <blockquote>
    <p>// return :
    C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll</p>
  </blockquote>
  
  <pre><code>3). Assembly.GetExecutingAssembly().Location
  </code></pre>
  
  <blockquote>
    <p>// returns empty string</p>
  </blockquote>
  
  <pre><code>4). AppDomain.CurrentDomain.BaseDirectory
  </code></pre>
  
  <blockquote>
    <p>// returns "C:\Windows\syswow64\" irrespective of the actual path</p>
  </blockquote>
  
  <p>Could anyone tell me how can I get directory path from where the installer is being executed?</p>