Question

I found this function Exec here http://fsharp.github.io/FAKE/apidocs/fake-processhelper-shell.html.

Target "UpdateTools" (fun _ ->
   Exec "cmd"
)

But I keep getting this error, when I try to run it: "The value or constructor 'Exec' is not defined".

I'm new to FAKE and have not used F#, so forgive me if this should be obvious.

Can someone tell me why this api is not accessible like that?

Was it helpful?

Solution

The documentation is documenting class Shell. That means, you need to call it like:

Target "UpdateTools" (fun _ ->
   ignore(Shell.Exec "cmd")
)

or, if you need to work with the error code further:

Target "UpdateTools" (fun _ ->
    let errorCode = Shell.Exec "cmd"
    //do something with the error code
    ()
)

Hope it is a bit clearer now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top