How to launch an F# console app from VS Code -
given simple f# console app:
[<entrypoint>] let main argv = printfn "hello world" console.readline() |> ignore 0
what need start console app in same manner ctrl f5 in visual studio. have tried running form fake build script using fake.processhelper:
target "run" (fun _ -> let exe = @"c:\source\code\fs_console_app\build\fs_console_app.exe" let errorcode = shell.asyncexec(exe, "", builddir) () )
hitting ctrl f5 receive following build report:
target duration ------ -------- build 00:00:00.3916039 run 00:00:00.0743197 total: 00:00:00.5605493 status: ok
but no sign of console application starting , waiting input.
i have preferred comment long, consider more of workaround answer, i'm not familiar fake. guess run target being executed being swallowed asyncexec or shows in fake output window (try exec) doesn't start new window.
you can create runcmd.bat (assuming you're on windows), , put following it, make sure file not in build directory might cleaned up:
start c:\source\code\fs_console_app\build\fs_console_app.exe
you need start kick off new cmd window. else of course, bash or powershell, etc.
then inside build.fsx:
target "run" (fun _ -> let exe = "path/to/runcmd.bat" printfn "%a" "hello world" shell.exec(exe) |> ignore ) // build order "clean" ==> "build" ==> "run" ==> "deploy"
now if run (via ctrl+shift+p) fake, , pick run, compiles, starts new command line , waits readline. works via ctrl+f5.
Comments
Post a Comment