Reading value from XML file throws error - FAKE F # MAKE

I am trying to read a value from an XML file from FAKE, but I am getting an error, i.e.

.fsx(9,16) : eror FS000: Incomplete structurd construct at or before this
 point in expression. Expected '->' or other token.

Below is my code, I use XMLHelper.XMLReadto read values ​​from an XML file.

#r "./packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.XMLHelper
Target "BuildMain" (fun _ ->
    for s in XMLHelper.XMLRead true "D:/test/Version.Config" "/version/major/minor"
        trace s)
"BuildMain"
RunTargetOrDefault "BuildMain"

Below is my xml file:

<version>
  <major number="2">
    <minor>1</minor>
    <build>1</build>
    <revised>1</revised>
  </major>
</version>

Here I am trying to read a value from a younger version, and, in addition, I can save this value in a variable so that I can use it later

+2
source share
1 answer

The design for ... inrequires either door arrows ->in front of the body:

for s in XMLHelper.XMLRead true "D:/test/Version.Config" "/version/major/minor" do
    trace s

You use doif the body is a different loop or just side code, as in:

for x in 1..5 do
   printfn "%d" x

->, , , :

let evenNumbers2to10 = [for x in 1..5 -> x*2]

-> do yield:

let evenNumbers2to10 = [for x in 1..5 do yield x*2]
+2

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


All Articles