title: Finding the home directory for a Visual Studio 2010 extension
body: <p>I am making changes to a Visual Studio wizard that creates a project from a template, and needs to add a reference to an assembly to the project that also lives in the extension directory. So I need to set the <code>&lt;hintpath&gt;</code>.</p>
  
  <p>I have not been able to figure out how a running VS extension can discover its extension directory, which is a directory name like this:</p>
  
  <blockquote>
    <p>%USERPROFILE%\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\myCompany\myExtension</p>
  </blockquote>
  
  <p>Using <code>System.Reflection.Assembly.GetExecutingAssembly().CodeBase</code> yields:</p>
  
  <blockquote>
    <p>"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\myCompany.myExtension\v4.0_1.0.0.0__936015a19c3638eb\myCompany.myExtension.dll"</p>
  </blockquote>
  
  <p>Unfortunately, not helpful.  Using <code>GetCallingAssembly()</code> is no better--it points at another directory in the MSIL_GAC. </p>
  
  <p>Is there a Visual Studio interface that returns this information?  I haven't been able to find it.</p>
  
  <p>If that's not possible, is it at least possible to determine if the extension is running in the experimental instance vs. non-experimental?  I could use that information to locate the extension directory.</p>