Reputation: 4302
I created a new VS2015 F# PCL Project targeting 4.5.1. I added in FSharp.Data and got the XML type provider to pull down the data:
#r "..\packages\FSharp.Data.2.2.5\lib\portable-net40+sl5+wp8+win8\FSharp.Data.dll"
open System.IO
open FSharp.Data
let baseDirectory = __SOURCE_DIRECTORY__
let baseDirectory' = Directory.GetParent(baseDirectory)
type Campaign = XmlProvider<"../Data/Campaign.xml">
let filePath = "Data\Campaign.xml"
let fullPath = Path.Combine(baseDirectory'.FullName, filePath)
let campaignText = File.ReadAllText(fullPath)
let campaigns = Campaign.Parse(campaignText)
When I try and dot the result, it is telling me that I need to add a reference to System.Xml.Linq. However, I can't add that library to a PCL project. Is there a way I can parse the data?
Upvotes: 0
Views: 106
Reputation: 2291
Just add the reference to System.Xml.Linq in your script file like so:
#r "packages\FSharp.Data.2.2.5\lib\portable-net40+sl5+wp8+win8\FSharp.Data.dll"
#r "System.Xml.Linq"
Upvotes: 2