Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9230165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:45:22+00:00 2026-06-18T05:45:22+00:00

Here is the scenario: Open Visual Studio. This was done in VS2010 Pro. Open

  • 0

Here is the scenario:

  1. Open Visual Studio. This was done in VS2010 Pro.
  2. Open F# Interactive within Visual Studio
  3. Open project with fsx file
    Note: Project and fsx file are in E:\<directories>\fsharp-tapl\arith
  4. Send commands to F# Interactive from fsx file

    > System.Environment.CurrentDirectory;; 
    val it : string = "C:\Users\Eric\AppData\Local\Temp"
    

    I was not expecting a Temp directory but it makes sense.

    > #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
    

    The #r command error shows that F# Interactive currently does not know the location of arith.exe.

    > #I @"bin\Debug"
    --> Added 'E:\<directories>\fsharp-tapl\arith\bin\Debug' 
    to library include path
    

    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
    E:\<directories>\fsharp-tapl\arith

    > #r @"arith.exe"
    --> Referenced 'E:\<directories>\fsharp-tapl\arith\bin\Debug\arith.exe'
    

    And F# Interactive correctly finds arith.exe reporting the correct absolute path.

    > open Main
    > eval "true;" ;;
    true
    val it : unit = ()
    

    This confirms that arith.exe was correctly found, loaded and works.

So how did F# Interactive #I command know the project path since the current directory is of no help?

What I am really after is from within F# Interactive how does one get the path to the project, E:\<directories>\fsharp-tapl\arith.

EDIT

> printfn __SOURCE_DIRECTORY__;;
E:\<directories>\fsharp-tapl\arith
val it : unit = ()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:45:23+00:00Added an answer on June 18, 2026 at 5:45 am

    In F# Interactive, the default directory to search is the source directory. You can query it easily using __SOURCE_DIRECTORY__.

    This behaviour is very convenient to allow you to use relative paths. You often have fsx files in the same folder with fs files.

    #load "Ast.fs"
    #load "Core.fs"
    

    When your refer to a relative path, F# Interactive will always use the implicit source directory as the starting point.

    #I ".."
    #r ... // Reference some dll in parent folder of source directory
    #I ".."
    #r ... // Reference some dll in that folder again
    

    If you want to remember the old directory for next reference, you should use #cd instead:

    #cd "bin"
    #r ... // Reference some dll in bin
    #cd "Debug"
    #r ... // Reference some dll in bin/Debug
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to open pdf file in webview but the scenario is different here,
Here's the scenario: I have a git project open in eclipse + egit (the
I have some problem in visual studio.Ok here is the scenario first i add
Is there some open source file upload (application) solution for a scenario like this?
Here's the scenario. As a creator of publicly licensed, open source APIs, my group
Here the scenario : A method is called each minute by a timer. This
Here's my scenario: I'm opening a window from a javascript file, and setting an
I'll start by describing a scenario, I'm open to other ways of doing this
I feel like this behavior should not be happening. Here's the scenario: Start a
Here's my scenario: Let's say I want to make a fix to an open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.