简体   繁体   English

Silverlight应用程序中的F#库?

[英]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. 我有一个F#库,该解决方案与我要在其中使用该Silverlight(C#)项目的解决方案相同。当我尝试向该库项目添加引用时,它说我只能添加Silverlight引用。 How can I make this F# library compatible with my Silverlight project? 如何使该F#库与我的Silverlight项目兼容?

I'm using Visual Studio 2010. 我正在使用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. 如果您在F#项目中引用了mscorlib.dllFSharp.Core.dll程序集的相应(非标准)版本,则F#编译器会为某些非标准运行时(例如Silverlight或Compact Framework)自动生成程序集。 The Silverlight version of the assemblies can be found here (on my machine): 程序集的Silverlight版本可以在以下位置找到(在我的机器上):

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 C:\\ Program Files(x86)\\参考程序集\\ 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. 这是Pretzel引用的问题中提到的--noframework--cli-root参数更友好的用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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