tags:

views:

86

answers:

2

I have an F# library in the same solution as a Silverlight (C#) project that I'd like to use the library in. When I try to add a reference to the library project, it says I can only add Silverlight references. How can I make this F# library compatible with my Silverlight project?

I'm using Visual Studio 2010.

A: 

The F# compiler automatically generates assembly for some non-standard runtime (such as Silverlight or Compact Framework) if you reference the appropriate (non-standard) version of the mscorlib.dll and FSharp.Core.dll assemblies in your F# project. The Silverlight version of the assemblies can be found here (on my machine):

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0\mscorlib.dll C:\Programs\Development\FSharp-1.9.9.9\Silverlight\2.0\bin\FSharp.Core.dll

This is a more user-friendly replacement for the --noframework and --cli-root parameters mentioned in the question referenced by Pretzel.

Tomas Petricek
+3  A: 

You need to start with an 'F# Silverlight Library' rather than 'F# library' project template.

Brian