Tuesday, March 3, 2009

F# error talking complaining about FSharp.PowerPack.dll

If your F# code compiles, but you see errors like this from fsi:

C:\Users\James\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\FSharpDictionary.fs(108,13): error FS0039: The value, constructor, namespace or type 'contains' is not defined. A construct with this name was found in FSharp.PowerPack.dll, which contains some modules and types that were implicitly referenced in some previous versions of F#. You may need to add an explicit reference to this DLL in order to compile this code.
>

Make sure you add PowerPack to your session:

> #r "FSharp.PowerPack.dll" ;;

My problem was that I had added FSharp.PowerPack to the Visual Studio project, but I had forgotten that fsi doesn't pick that up.

And with the new 2010 release, you're going to need to add the location of PowerPack to your search path in fsi.exe:

  > #r "FSharp.PowerPack.dll" ;;
    > #I "C:\Users\James\Documents\Visual Studio 10\Projects\fspowerpack"

Watch out for quoting backspaces in strings.

1 comment:

Isak said...

That helped, thanks.

People should also know that in order to use that "#r" statement, the powerpack has to be copied to

C:\Program Files\Microsoft F#\v4.0