Why doesn't #load work
I've tried it in the same folder and in a relative folder as below
What am I missing?
run.fsx is
#load "../shared/shared.fsx"
let key = "MyKey"
let Run(message: string, log: TraceWriter, result: byref<string>) =
result <- doItAll message key
log.Info(sprintf "F# results: %s" result)
shared.fsx is
let doItAll message key = key + " has handled " + message
error is
run.fsx(x,y): error FS39: The value or constructor 'doItAll' is not defined
If you do not specify a namespace or a module name explicitly in shared.fsx
, then the F# compiler will put the code in the file in an implicitly named module Shared
. You should be able to fix the error by adding open Shared
:
#load "../shared/shared.fsx"
open Shared
let key = "MyKey"
let Run(message: string, log: TraceWriter, result: byref<string>) =
result <- doItAll message key
log.Info(sprintf "F# results: %s" result)
If you want to control the naming yourself, you can also add module
declaration in shared.fsx
and give an explicit name yourself:
module SharedStuff
let doItAll message key = key + " has handled " + message
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With