Codementor Events

Contributing to the F# Compiler Service

Published Mar 22, 2018Last updated Sep 18, 2018

Following my previous Blog Post on the F# Community. I promised to show how to setup and build the F# Compiler locally on your machine. This walk through is just for windows users. I have absolutely no idea how to contribute from a Mac. You could use something like Parallels to run windows in a Mac and contribute that way.


Your Contributions will be made directly to the Visual F# Compiler Repo

Step 1 — Get Visual Studio + Tools

So to get started you need to get Visual Studio 2017. There is a Community Edition which is absolutely free. But if you already have Professional or Enterprise, that will work too.

You need to install

  • F# Language Support
  • Visual Studio Extension Development Workload


F# Language Support

Its a web setup so it might take a while. But once it’s done, you can now move on to the next stage

Step 2 — Clone the Visual F# Repository

The next step is to clone/fork the Visual F# Repository After cloning, you can checkout any branch you wish. For the sake of this walk-through, I will checkout feature/fmt branch which adds Auto Formatting to the Visual F# Editor.


Cloned Visual F# Repository

Step 3 — Restore and Build Repository

Contrary to what you might think, you can’t just jump in and open one of the Solution Files and start Hacking away. You will need to build it from the command line.

However, the way to reliably build it is to Build it from the “Developer Command Prompt for VS 2017” just search for that from the Start Menu and You’ll see it. Also you need to right-click and run it as administrator

Its from this prompt that you should navigate to the directory that you cloned and then run

build.cmd vs debug

This will restore all the packages and run all build scripts. So.. It going to take a while. When it’s done, you’ll see something like


Build Succeeded!

Step 4: Run Visual Studio Tools

You can now Launch Visual Studio open the VisualFsharp.sln file and setup VisualFSharpOpenSource as your default project and you are good to go. You could also just right-click and debug and it will launch a new instance of Visual Studio which has the your custom build of the Visual FSharp vsix loaded and you can debug the Visual F# Compiler and Tools.

If you have Visual Studio Enterprise, you could use Code Map tool to look at the projects and see they way they all fit together. I have created a snapshot I have removed the unnecessary projects.


Code Map of the F# Compiler Service

Conclusion

I hope this post has been helpful in showing the steps to building and running the F# Tools. Its no where as scary as I thought it. If you want to help out you start by looking at the issues marked “Up for Grabs” and sending pull requests. If you still have any problems with the Steps mentioned above, you can reach me on twitter @odytrice

Discover and read more posts from Ody Mbegbu
get started