Reading Xml file throws error - FAKE F # MAKE

I am reading an XML file in a FAKE script using XMLHelper.XMLRead, but it throws an error, i.e.

The type '(string -> string ->seq<string>)' is not a type whose value can be enumerated with this syantax , i.e. is not compatible with either seq<_>,IEnumerable<_> or IEnumerable and does not have a GetEnumerator method

Below is my code:

let x = XMLHelper.XMLRead true "D:/test/Version.Config" "/version/major/minor" 
Target "New" (fun _ ->
    for i in x do
        printf "%s" i
)
+4
source share
1 answer

If you look at the API documentation forXMLHelper , you will see that the function signature for XMLReadlooks like this:

failOnError:bool -> xmlFileName:string -> nameSpace:string -> prefix:string -> xPath:string -> seq<string>

, failOnError, xmlFileName nameSpace *, . F # , , , XMLRead, , (, string -> string -> (result) ).

* , , "/version/major/minor" xPath, F # , , nameSpace.

, , XMLRead. XMLRead, nameSpace prefix , XML . , :

let x = XMLHelper.XMLRead true "D:/test/Version.Config" "" "" "/version/major/minor" 
Target "New" (fun _ ->
    for i in x do
        printf "%s" i
)

, , , , XMLHelper.XMLRead_Int:

let minorVersion =
    match XMLHelper.XMLRead_Int true "D:/test/Version.Config" "" "" "/version/major/minor" with
    | true, v -> v
    | false, _ -> failwith "Minor version should have been an int"

, int minorVersion, script , Version.Config.

+4

Source: https://habr.com/ru/post/1672780/


All Articles