I have a library, Library_1, which compiles correctly and defines a provided type :
type modelforexcel = FSharpx.ExcelFile<@"template.xls", "Brokernet", true>
When I include this library in another project, Library_2, the compiler complains that it can't find any "Brokernet.template.xls", at the root of the new Library_2 project.
Error 4 'C:\Library_2\template.xls' could not be found. Check the spelling of the file name, and verify that the file location is correct.
I would like the type to refer to the original "Brokernet.template.xls", so I am trying to provide the complete path to it, but
type modelforexcel =
FSharpx.ExcelFile<__SOURCE_DIRECTORY__+@"Brokernet.template.xls", "Brokernet", true>
does not work, as I guess it is not a literal (?) But 'obviously' defining this literal does not work either
[<Literal>]
let a = __SOURCE_DIRECTORY__+@"Brokernet.template.xls"
Are there any way to define such a 'dynamic literal' ?
edit
Interestingly enough, if I define my type inside a module in the first library
module Load =
[<Literal>]
let a = @"Brokernet.template.xls"
type modelforexcel = FSharpx.ExcelFile< a , "Brokernet", true>
Then the type is not 'regenerated' upon using the first library in the second one, and the type provider does not complain about the file being absent of the root of the 2nd library.
This sheds profound insights in the compilation model of F# that are probably best exposed by masters. I'd just say, as a rough man, that "the code is in modules"
PS : I guess thats one more problem which would be solved by a proper staged compilation.