How does F# Interactive #I command know about project path?

狂风中的少年 提交于 2019-12-03 06:32:32

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!