Search code examples
dllf#intellisensequery-expressions

Why does intellisense fail on my F# script?


I've been building a library to interact with one of my databases at work and everything is working fine. But when I open a new script and begin to use the library, it always freaks out when I try to use query expressions on the database. They work when I send them to F# interactive but the intellisense fails, drawing red lines under everything. Why is this? I would like my own dll to be the only thing a user would need to reference for a script.

enter image description here

System.Data.Linq is a reference in my dll file and I've set its Copy Local property to True to no avail. Other than that I haven't the faintest clue of what could be wrong.


Solution

  • What you're showing in the screenshot is evidently an F# script (an .fsx file). Since the code that tries to access the table is in the script file, it is the script file that needs a reference to System.Data.Linq. The fact that your AIXSupport.dll library has the reference does not help: references do not "transfer" like that.

    Simply add this one at the beginning of the script:

    #r "System.Data.Linq"