title: How do I get the path of the assembly the code is in?
body: <p>Is there a way to get the path for the assembly in which the current code resides?  I do not want the path of the calling assembly, just the one containing the code. </p>
  
  <p>Basically my unit test needs to read some xml test files which are located relative to the  dll.  I want the path to always resolve correctly regardless of whether the testing dll is run from TestDriven.NET, the MbUnit GUI or something else.</p>
  
  <p><strong>Edit</strong>: People seem to be misunderstanding what I'm asking.</p>
  
  <p>My test library is located in say </p>
  
  <blockquote>
    <p>C:\projects\myapplication\daotests\bin\Debug\daotests.dll</p>
  </blockquote>
  
  <p>and I would like to get this path:</p>
  
  <blockquote>
    <p>C:\projects\myapplication\daotests\bin\Debug\</p>
  </blockquote>
  
  <p>The three suggestions so far fail me when I run from the MbUnit Gui:</p>
  
  <ul>
  <li><p><code>Environment.CurrentDirectory</code>
  gives <em>c:\Program Files\MbUnit</em></p></li>
  <li><p><code>System.Reflection.Assembly.GetAssembly(typeof(DaoTests)).Location</code>
  gives <em>C:\Documents and
  Settings\george\Local
  Settings\Temp\ ....\DaoTests.dll</em></p></li>
  <li><p><code>System.Reflection.Assembly.GetExecutingAssembly().Location</code>
  gives the same as the previous.</p></li>
  </ul>