2

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.

jks612
  • 1,224
  • 1
  • 11
  • 20

1 Answers1

3

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"
Fyodor Soikin
  • 78,590
  • 9
  • 125
  • 172
  • Is it possible to compile `System.Data.Linq` inside of my own dll so that is not necessary? – jks612 Jan 08 '18 at 04:57
  • Yes, there are tools for that. Take a look here: https://peteris.rocks/blog/merging-net-assemblies-with-msbuild/ – Fyodor Soikin Jan 08 '18 at 05:48
  • 3
    @jks612 You could also distribute a .fsx containing all expected references alongside your dll. Users would then `#load “your.fsx”` instead of `#r “your.dll”` – CaringDev Jan 08 '18 at 06:03