Using folders in F# projects in Visual Studio

by Gregor Uhlenheuer on December 3, 2012

For some strange reasons it is not possible to add folders to F# projects in Visual Studio. Neither the 2010 edition nor the new 2012 version supports such an important feature. However the good message is that it is indeed possible to add folders on your own.

Edit your project file

To add folders to your F# project you have to edit the project file (*.fsproj) by hand using your favorite text editor. Search for the item group with all the Compile statements:

Now you just have to add your new Compile, Resource or whatever statements to that item group:

After you matched your file system structure with your file paths you can reload your project and enjoy your ordered project structure. Now you can even add subfolders to already existing folders via the Visual Studio context menu.

This post is tagged with f#, visualstudio, .net and programming