Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何让F#Interactive window使用与项目相同的路径?_F#_F# Interactive - Fatal编程技术网

如何让F#Interactive window使用与项目相同的路径?

如何让F#Interactive window使用与项目相同的路径?,f#,f#-interactive,F#,F# Interactive,在我的项目中,我打开了一个与可执行文件有相对路径的文件。我试图在F#Interactive窗口中测试我的代码,但它似乎从一个完全不同的路径运行。如何更改路径/使其从与项目相同的路径运行?我认为标识符在这里可能会有所帮助 您应该使用来区分使用F#Interactive和编译F#project 在FSI中运行时,可以设置当前工作目录: #if INTERACTIVE System.IO.Directory.SetCurrentDirectory("<project_path>") #en

在我的项目中,我打开了一个与可执行文件有相对路径的文件。我试图在F#Interactive窗口中测试我的代码,但它似乎从一个完全不同的路径运行。如何更改路径/使其从与项目相同的路径运行?

我认为标识符在这里可能会有所帮助

您应该使用来区分使用F#Interactive和编译F#project


在FSI中运行时,可以设置当前工作目录:

#if INTERACTIVE
System.IO.Directory.SetCurrentDirectory("<project_path>")
#endif
#如果是交互式的
System.IO.Directory.SetCurrentDirectory(“”)
#恩迪夫

不错!即使您突出显示文件中的某些代码并“以交互方式执行”,也可以这样做。
#if INTERACTIVE
System.IO.Directory.SetCurrentDirectory("<project_path>")
#endif