简体   繁体   中英

F# Library in Silverlight Application?

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.

您需要从“ F#Silverlight库”而不是“ F#库”项目模板开始。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM