문제

How could I make this work?

#I (__SOURCE_DIRECTORY__ + @"\bin\Release")

And second questions. Is it possible to do something like:

let path = __SOURCE_DIRECTORY__ + @"\bin\Release"
#I path

?

도움이 되었습니까?

해결책

You can't. The #I and #r commands are really pre-processor instructions that are executed before the code is dynamically compiled by fsi, so they only support string literals. This is logical if you think about it, as the referenced assemblies maybe need to compile the code.

However, the #r and #I command always take relative paths as being from the scripts location, so this

#I @".\bin\Release"

should work just fine (note the dot to ensure it’s a relative not an absolute path).

Note that runtimes relative paths are from the fsi working directory (normally the temp directory) so you do need to use __SOURCE_DIRECTORY__ when loading files from you’re scripts.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top