Getting started with F# and Visual Studio Code on Windows – Part III Create, run and debug a F# Console application

Part I Introduction
Part II Installation development environment
Part III Create, run and debug a F# Console application

The first step is now to create a console application with the Command Palette, press CTRL + Shift + P, type F#: New Project

Then, select console. After you can type a project directory or leave blank.

After a last dialog, the enter the project name. The IDE will start to build the project.

To test this you press CTRL+~ so the integrated terminal opens and execute the build.cmd. If everything goes well there will be an application .exe in the bin folder.

Then debugging. As I write this I read on internet a next version will have this automated but for now I will explain how I got around getting this to work. First of all the C# extension should be installed in Code. When I started debugging I got this error:

I think this was because I first installed Code and run some local restore, no idea. The error is explains what to do so that was easy to fix.
Next thing is to sets some paths in the task.json and launch.json; these should point to the dll in the build folder.

If that’s, just set a break point and start the debugger.

So, there is it, creating, running and debugging F# console application in VS Code!

Leave a Reply

Your email address will not be published. Required fields are marked *