Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How setup Visual Studio Code for Run/Debug of F# projects/scripts?

I have tried to use Visual Studio Code for run a simple F# script.

I download all recent versions as today. I install all the plugins at http://ionide.io/. Despite the nice animated gifs that show that it works, I'm unable to see how make to work the Build of code.

I create a .ionide file:

[Fake]
linuxPrefix = "mono"
command = "build.cmd"
build = "build.fsx"

But then, how install Fake? So, I do this from xamarin and install it. Ok, so now I get the build.fsx:

#r "packages/FAKE.4.12.0/tools/FakeLib.dll" // include Fake lib
RestorePackages()

// Properties
let buildDir = "./build/"
let testDir  = "./test/"
let deployDir = "./deploy/"

// version info
let version = "0.2"  // or retrieve from CI server

// Targets
Target "Clean" (fun _ ->
    CleanDirs [buildDir; testDir; deployDir]
)

Target "fakeBuild" (fun _ ->
!! "./*.fsproj"
    |> MSBuildRelease buildDir "Build"
    |> Log "AppBuild-Output: "
)

Target "Default" (fun _ ->
    trace "Hello World from FAKE"
)

// Dependencies
"Clean"
==> "fakeBuild"
==> "Default"

// start build
RunTargetOrDefault "Default"

Run the Fake:Build command and get:

No handler found for the command: 'fake.fakeBuild'. Ensure there is an activation event defined, if you are an extension.

And now get lost.

like image 509
mamcx Avatar asked Dec 30 '15 14:12

mamcx


People also ask

How do you run in debug mode in Visual Studio code?

To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.

How do I set Debug configuration in Visual Studio?

In Solution Explorer, right-click the project and choose Properties. In the side pane, choose Build (or Compile in Visual Basic). In the Configuration list at the top, choose Debug or Release. Select the Advanced button (or the Advanced Compile Options button in Visual Basic).

How do you get the run symbol in VS Code?

Check that you have the Code Runner extension enabled. The Extensions marketplace is accessible through the fifth button down on the toolbar. If it is installed and enabled, you should see a Run button on the top-right of the tab bar.


1 Answers

install yeoman: ">ext install yeoman" then setup a stand alone project with >yo and follow the instructions and say yes to paket and FAKE.

then >paket init and >paket install and it should work.

to get the > use ctrl+shift+p

For the Atom IDE you also have to install the yeoman npm package which I describe here: http://www.implementingeventsourcingwithfsharp.com/?p=61

how to install the package is descibed here: https://www.npmjs.com/package/generator-fsharp

not sure you need it for Visual Studio Code

Hope this helps

like image 100
Rick Avatar answered Oct 13 '22 22:10

Rick