I 바탕 화면의 "새 폴더"에있는 다음 파일이 있습니다F # FSI, 변경 작업 디렉토리
// File location: "C:\Users\my_user_name\Desktop\New folder\AddOne.fs"
//
module internal AddOneModule
let AddOneFunction x = x + 1
내가 FSI F # 대화를 사용하여 전체 경로 이름을 #LOAD를 사용하여이 파일에 액세스 할 수 있습니다.
Microsoft (R) F# Interactive version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> #load "C:\Users\my_user_name\Desktop\New folder\AddOne.fs";;
//[Loading C:\Users\my_user_name\Desktop\New folder\AddOne.fs]
//namespace FSI_0002
// val AddOneFunction : x:int -> int
> open AddOneModule;;
> AddOneFunction 100;;
// val it : int = 101
어떻게 상대 경로를 사용하여 파일에 액세스 할 수 있도록 작업 디렉토리를 변경합니까?
F# interactive:how to display/change current working directory
나는 위의 게시물에 비슷한 시도했지만 FSI는 여전히 Temp 폴더에있는 파일을 찾습니다 : 이 (FSI를 RESET)Microsoft (R) F# Interactive version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> open System;;
> Environment.CurrentDirectory <- @"C:\Users\my_user_name\Desktop\New folder";;
//val it : unit =()
> #load "AddOne.fs";;
// #load "AddOne.fs";;
// ^^^^^^^^^^^^^^^^^
//C:\Users\my_user_name\Desktop\New folder\stdin(3,1): error FS0078: Unable to find
//the file 'AddOne.fs' in any of
// C:\Users\my_user_name\AppData\Local\Temp
을 주셔서 감사합니다 당신의 도움.
내 추천은 절대로 FSI에 직접 입력하지 마십시오. 필요한 경우 스크립트 파일을 작성하고 FSI에 코드 행을 보냅니다. 이렇게하면 상대 경로에서 파일을로드 할 수 있습니다 (자동 완성, 오류 밑줄). 완전한 툴링 지원 (자동 완성, 오류 밑줄)을 얻을 수 있으며';; '을 입력 할 필요가 없습니다. – TheQuickBrownFox