Hacking referenced assemblies
assemblies, f#
Solution
The behavior of F# Interactive can be a bit odd in this case. In general, I think that things work better when you use `#I` to include the path with referenced assemblies in the resolution context and then reference the libraries by name using `#r`. So if you have a library `Fmat.Numerics.dll` in a folder `C:\libs` and it references another library `another.dll` then you can do:
#I "C:\\libs"
#r "another.dll"
#r "Fmat.Numerics.dll`
The first line means that F# Interactive will automatically look in the folder with your libraries (this can be relative path to your script location too) - as a result, the next two lines can just reference the libraries by their file names.
Problem
I am aware that there are already other questions on the topic, such as: - This one - This one - This other one .. but hey, I am new to F# and still don't get it. I have a F# project (`thelibrary`) which contains some modules. This project references in the solution explorer all the necessary libraries. Each `.fs` file opens the libraries used in the module. The F# project compiles properly. I have then another F# project which contains a script. I reference `thelibrary` and the libraries used by `thelibrary` itself. In the script I reference with `#r` the dll with `thelibrary` and all the libraries used by `thelibrary`. I then `open` all the modules. Intellisense says all is allright until I execute the script. The script returns the error: ``` error FS0074: The type referenced through 'Fmat.Numerics.Matrix`2' is defined in an assembly that is not referenced. You must add a reference to assembly 'Fmat.Numerics'. ``` What is the procedure to hack this problem? How do I proceed from there? I am interested is a solution to this specific problem but, as well, a cookbook recipe to fix this type of issues that have been quite a source of frustration for me. Thank you.