title: How does F# Interactive #I command know about project path?
body: <p>Here is the scenario:</p>
  
  <ol>
  <li>Open Visual Studio. This was done in VS2010 Pro.</li>
  <li>Open F# Interactive within Visual Studio</li>
  <li>Open project with fsx file<br>
     Note: Project and fsx file are in <code>E:\&lt;directories&gt;\fsharp-tapl\arith</code></li>
  <li><p>Send commands to F# Interactive from fsx file  </p>
  
  <pre><code>&gt; System.Environment.CurrentDirectory;; 
  val it : string = "C:\Users\Eric\AppData\Local\Temp"
  </code></pre>
  
  <p>I was not expecting a Temp directory but it makes sense.</p>
  
  <pre><code>&gt; #r @"arith.exe"
  Examples.fsx(7,1): error FS0082: Could not resolve this reference. 
  Could not locate the assembly "arith.exe". 
  Check to make sure the assembly exists on disk. 
  If this reference is required by your code, you may get compilation errors. 
  (Code=MSB3245)
  
  Examples.fsx(7,1): error FS0084: Assembly reference 'arith.exe' was not found 
  or is invalid
  </code></pre>
  
  <p>The #r command error shows that F# Interactive currently does not know the location of arith.exe.</p>
  
  <pre><code>&gt; #I @"bin\Debug"
  --&gt; Added 'E:\&lt;directories&gt;\fsharp-tapl\arith\bin\Debug' 
  to library include path
  </code></pre>
  
  <p>So we tell F# Interactive the location of the arith.exe.
  Notice that the path is NOT an absolute path but a sub-path of the project.
  I have not told F# Interactive the location of the arith project
  <code>E:\&lt;directories&gt;\fsharp-tapl\arith</code></p>
  
  <pre><code>&gt; #r @"arith.exe"
  --&gt; Referenced 'E:\&lt;directories&gt;\fsharp-tapl\arith\bin\Debug\arith.exe'
  </code></pre>
  
  <p>And F# Interactive correctly finds arith.exe reporting the correct absolute path.</p>
  
  <pre><code>&gt; open Main
  &gt; eval "true;" ;;
  true
  val it : unit = ()
  </code></pre>
  
  <p>This confirms that arith.exe was correctly found, loaded and works.</p></li>
  </ol>
  
  <p>So how did F# Interactive #I command know the project path since the current directory is of no help? </p>
  
  <p>What I am really after is from within F# Interactive how does one get the path to the project, <code>E:\&lt;directories&gt;\fsharp-tapl\arith</code>. </p>
  
  <p>EDIT</p>
  
  <pre><code>&gt; printfn __SOURCE_DIRECTORY__;;
  E:\&lt;directories&gt;\fsharp-tapl\arith
  val it : unit = ()
  </code></pre>