I'm fresh to F#, but I really want to learn it. I know Python, I know C#. As a matter of fact, I've got a C# library that I've made myself; it's an wrapper for the Rdio API (I've named it RdioSharp) that I can successfully bring into another C# project and call it, use it, get data... it works.
I want to get started toying around with this C# library in an F# project, but it's not working right. Here's a brief snipped of what the C# code looks like.
namespace RdioSharp {
public class RdioManager {
public RdioManager() { }
}
}
I've added the reference to the DLL in my FSharpTest
project, I've pulled up a .fsx
file, and I've tried the following, each line below (again, keep in mind, I really have no idea what I'm doing).
open RdioSharp
open RdioSharp.dll
#r "RdioSharp.dll"
#r "C:\Path\To\Library\RdioSharp.dll"
I can't figure this one out. I know how to use system F# libraries,开发者_运维技巧 but how do I reference a C# library in F#? Is it possible? Is this enough information to go on?
I've seen this and this (which gets even closer to my problem) but those folks all know more about F# than I do, and they're way ahead of my problem.
In the interactive window, when punching in #r "RdioSharp.dll";;
, I get this lovely error.
error FS0084: Assembly reference 'RdioSharp.dll' was not found or is invalid
The following code works if F# environment can find the location of Rdiosharp.dll
. Usually not! So it does not work and tells you that "error FS0084: Assembly reference 'RdioSharp.dll' was not found or is invalid".
#r "RdioSharp.dll"
You can provide the exact path of this dll as in:
#r @"c:\temp\RdioSharp.dll"
or you can add its folder into search-path:
#I @"c:\temp"
精彩评论