简体   繁体   中英

F# error FS0039: The type 'XmlProvider' is not defined

Looked at these for a couple solutions--but nothing works
The type 'XmlProvider' is not defined
F# Data New type provider library
F# Data: XML Type Provider

open FSharp.Data
type XMLcountries = XmlProvider<"http://api.worldbank.org/country">
let sampleCountries = XMLcountries.GetSample()
let sampleCountries' = XMLcountries.Load("http://api.worldbank.org/country")

When using the interactive window, I get F# error FS0039: The type 'XmlProvider' is not defined. Is there a better package/library to use XML provider(and JSON too).

I have updated FSharp.Data to version 2.3.1

I added open FSharp.Data.TypeProviders to see if that would work. Still same error.

This is extremely frustrating.

Are you sure you have looked at F# Data: XML Type Provider ? Because at the very beginning it says:

#r "../../../bin/FSharp.Data.dll"
#r "System.Xml.Linq.dll"
open FSharp.Data

So you have a couple of options, if you don't want to install FSlab, the second one is the easiest for you. You obviously have to adjust the path to match your environment.

  1. Download and install FSLab , then reference FSLab with
    #load @"..\\..\\FSLAB\\packages\\FSLAB\\FsLab.fsx"
  2. Reference FSharp.Data.dll in your script:
    #r @"..\\..\\FSLAB\\packages\\FSharp.Data\\lib\\net40\\FSharp.Data.dll"
  3. Add FSharp.Data to your References in Visual Studio and send the reference to FSI with a rigt-click (I do hope you have installed the Visual F# Power Tools ).

Visual F#电动工具

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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