问题
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".
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
回答1:
references in script files (and FSI) are added via #r directive
#r "System.ServiceModel"
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
来源:https://stackoverflow.com/questions/3521706/servicemodel-and-f