So, in Project AB, I have FileA.fs and FileB.fs. FileB uses definitions from FileA, and both FileA and FileB use definitions from Project C (written in C #).
In FileA.FS, I have:
#if COMPILED namespace ProjectAB #else #I "bin\debug" #r "ProjectZ.dll" #endif
... which works the way it should - I can run the whole file in F # -Interactive and thatโs great.
In FileB.fs, my title is:
#if COMPILED module ProjectAB.ModuleB #else #load "FileA.fs" #I "bin\debug" #r "ProjectZ.dll" #endif
But when I run this (from FileB), I get an error:
FileA.fs(6,1): error FS0222: Files in libraries or multiple-file applications must begin with a namespace or module declaration, eg 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration.
According to the fsi.exe link, the #load directive reads the source file, compiles it and runs it. But it looks like this should be done without the COMPILED directive, because it does not see the ProjectAB declaration.
How to set headers so that I can run any file in F # -interactive?
Edit In response to latkin below, I created a script as the last file in the project, _TestScript.fsx. I removed all the precompiler materials from other files and set this as the header of the .fsx file:
#if INTERACTIVE #I "bin\debug" #r "ProjectZ.dll" #load "FileA.fs" #load "FileB.fs" #endif
When I run this interactively, it loads ProjectZ, FileA and FileB correctly for access in the interactive window.
However, in _TestScript.fsx I get short-term red lines and not intellisense for any of the functions / types from the referenced files (including the "open" statements).
Is there anything else I need to configure in the script file to make intellisense work? (The answer may be quite simple, as I have not used .fsx files before.)