質問

I am trying to find a easy example or introduction to a CSV Type provider. So I followed this link to help me get started. Now I have a Visual Studio 2012 students edition and while documentation says that F# 3.0 has the CSV type provider I am not able to find it. So I am trying to use a type provider for a local CSV File. What I see is that the CSV TypeProvider mentioned does not exist at all. Since the given examples don't really compile I looked around and used something like this to load the oData services :

#r "FSharp.Data.TypeProviders"
///loading a stackoverflow odata type provider
type stackOverflow = Microsoft.FSharp.Data.TypeProviders.ODataService<"http://data.stackexchange.com/stackoverflow/atom">

So this is a bit different from what is mentioned in the example page above. I am not able to see the csv type provider. I use the Visual Studio IDE to list the type providers and csv is not listed. I tried updating the packages using nuget and this still persists. Can anyone point the right documentation on how to work with a csv type provider and also the right updated links where a simple example could be found?

役に立ちましたか?

解決

FSharp.Data isn't a built-in library, so you either need to use nuget or manually download the package. See here for more information on where to get it (and how to use it).

If you manually download the project you can put it wherever you want and then simply use a file path to reference it with #r. For a path relative to your project, use the __SOURCE_DIRECTORY__ symbol, otherwise you can simply use the absolute file path of the .dll.

After referencing the dll, you still need to open the namespace, so you need to have open FSharp.Data after you reference the dll.

他のヒント

Alright so this is what I did. I used Nuget to manage references and I installed the FSharp.Data and FSharp.Data.TypeProviders and like @mydogisbox mentioned I then use the open FSharp.Data to load the csv files i.e.

open FSharp.Data.Csv

While this works if I use Nuget, it doesn't work otherwise. So have to figure out how to do that. For now this should suffice I guess.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top