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!

Getting started with F# and Visual Studio Code on Windows – Part II Installation development environment

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

The initial goal was to do a simple Hello World with F# + Suave, I quickly found out my initial dev rig had some issues. So, I decided to start with a clean Windows Virtual Machine and then install it piece by piece, starting with Visual Studio Code. This results in a list of components that might not all be need to be installed, but I think like this you’ll have good a base to build applications on .Net 4.6 and .Net Core.

There are at least two ways to create a basic project. One is to use to .Net core CLI, the other, what drove this blog post, is the functionality provided by Ionide-FSharp and the Command Palette of VS Code. This means pressing CTRL + Shift + P and selecting/typing F#: New Project. I didn’t create a .Net Core project yet, but an installation of the .Net core was needed to get things working.

The libraries:

Visual Studio Code

The next bits I didn’t install initially, the sample in the next blog could run without out it (works on .Net 4.6.1). I think you’ll need this to build F# applications that use .Net Core.

With this I eventually could do create, run and debug a Hello Worldish console application.

Getting started with F# and Visual Studio Code on Windows – Part I Introduction

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

For more than a year I’m a spectator of the F# community, eager to learn something new but as a dad of two young boys no time & energy to really dive into to the material. Luckily, children do grow and a slowly I begin to claim back my life 😉 Time to pick-up some learning and blogging! I’m a Visual Studio C# guy, no previous experience with functional programming languages so this all new stuff for me.

This is the technology I want focus on in the coming time:

  • F#, of course
  • Visual Studio Code, because I found the Visual Studio experience not as smooth and people kept tweeting Code is the best
  • Suave and/or Giraffe
  • .Net Core

Some nice side technologies:

  • FAKE, build tools F#. As a Visual Studio guy, I never really bothered much with the ins and outs of the build, this seems a nice way to start doing this some more.
  • Paket, this also seems to be the best thing since sliced bread according to some people.
  • Azure, it would be cool to eventually use the continuous integration and deployment tooling to make all this 2017 proof.

First things first, getting to a Hello World type of stage with the F# stack. This starts with a development environment, finding out how, what and installing this didn’t turned out to be a smooth and easy as I was led to believe. Big part of this is of course a lot new bits & bytes. So here is a blog with my findings to a get to a good start environment for developing F# stuff.