title: Windows Service installation - current directory
body: <p>this question is related to my  <a href="https://stackoverflow.com/questions/6043663/windows-service-how-to-make-name-configurable">previous one</a> . I've written a service in C# and I need to make it's name dynamic and load the name from configuration file. The problem is that current directory while the service installer is invoked is the net framework 4 directory instead of the one that my assembly sits in.</p>
  
  <p>Using the line (which helps with the same problem, but while the service is already running)
  <code>System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);</code></p>
  
  <p>sets the directory to</p>
  
  <pre><code>C:\Windows\Microsoft.NET\Framework\v4.0.30319
  </code></pre>
  
  <p>which was also the initial value.</p>
  
  <p>How to get the right path?</p>