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?

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top