質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top