ServiceModel和f# [英] ServiceModel and f#
问题描述
我只是从f#开始,所以对于某些人来说,这个问题似乎很容易.因此,我尝试使用位于System.ServiceModel.Syndication命名空间中的SyndicationFeed.我在项目中添加了以下引用:System.ServiceModel和System.ServiceModel.Web.结果是它构建成功,但是当我切换到"F#交互式"窗口时,出现一条错误消息,内容为错误FS0039:未定义名称空间'ServiceModel'".
I am just starting with f# so the question may seem easy for some of you. so, I am trying to use SyndicationFeed which is located in System.ServiceModel.Syndication namespace. I added following references: System.ServiceModel and System.ServiceModel.Web to the project. The result is that it builds successfully, but when I switch to "F# interactive" window I got an error which reads "error FS0039: The namespace 'ServiceModel' is not defined".
我瞪着眼,我也应该添加对FSharp.PowerPack的引用,以摆脱此错误,但不幸的是,它没有帮助.伙计们,我指望您的帮助
I goggled that I should also add reference to FSharp.PowerPack, in order to get rid this error but unfortunately it did not help. So guys I count on your help
推荐答案
通过#r指令添加脚本文件(和FSI)中的引用
references in script files (and FSI) are added via #r directive
#r "System.ServiceModel"
您可以在源代码中添加如下部分,以便fsc可以使用它并将其发送到fsi
you can add parts like below to you source code so it can be both used by fsc and sent to fsi
#if INTERACTIVE
#r "System.ServiceModel"
#endif
这篇关于ServiceModel和f#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!