Skip to content

XmlProvider captures current directory at design time #818

@kkm000

Description

@kkm000

When compiling in Visual Studio 2013, FSharp.Data version="2.2.0" targetFramework="net45".

This works only when foo.xml is in the same directory where the executable file built. Runtime current directory seems not to have any effect. Setting "Working directory" in project properties or changing the current directory with Directory.SetCurrentDirectory is ignored.

type NamesDotXml = XmlProvider<"<items><item weight='10'>James</item></items>">
let loadNames (filename:string) =  NamesDotXml.Load(filename).Items
let n = loadNames("foo.xml")

Workaround, this works as expected, foo.xml is correctly found in the current directory. Both the Working Directory project setting and a runtime change with Directory.SetCurrentDirectory are respected:

type NamesDotXml = XmlProvider<"<items><item weight='10'>James</item></items>">
let loadNames (filename:string) =  NamesDotXml.Load(System.IO.File.OpenText(filename)).Items
let n = loadNames("foo.xml")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions