fsprojects / FSharp.Configuration

The FSharp.Configuration project contains type providers for the configuration of .NET projects.
http://fsprojects.github.io/FSharp.Configuration/
Other
114 stars 63 forks source link

Config.yaml could not be opened in FSI #109

Open vilinski opened 7 years ago

vilinski commented 7 years ago

Hi, perhaps I do something wrong, therefore this is rather a question.

I have a project with a file Config.fs:

module Config

open FSharp.Configuration

type Credentials = YamlConfig<"Config.yaml">

I works actually, and unit tests are green. But if I start using it in the FSI with this script, it can't load the file.


#I "../../build"
#cd "../../build"
#r "DoStuff.exe"

open DoStuff

let result = doStuffInternallyUsingConfig()

Whats going on here?

Attempt 1 of 5: cannot read Config.yaml. Sleep for 1 sec, then retry...
......
Attempt 5 of 5: cannot read Config.yaml. Sleep for 1 sec, then retry...
System.TypeInitializationException: ... ---> System.IO.FileNotFoundException: File
, Config.yaml could not be opened after 5 attempts.
.....
Stopped due to error
vilinski commented 7 years ago

Sorry for time wasting, I was too eager to ask. With experimenting around, found out myself that Ionide starts FSI with root folder as a working directory. That was a trick, which I have already seen before enywhere

System.IO.Directory.SetCurrentDirectory __SOURCE_DIRECTORY__