Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I add a subfolder in a F# project?

In most .NET project I can use folder to organise the code files. In C++, I can't, but filters end up playing the same role. However, in F# with Visual Studio 2010, I can't. Every code file is shown directly in the project dir. Why is this feature not available?

And what is the optimal strategy for organizing a project with a lot of files?

like image 459
Laurent Bourgault-Roy Avatar asked May 07 '11 01:05

Laurent Bourgault-Roy


1 Answers

Actually, you can add folders to F# projects but it's not supported directly through Visual Studio (you have to edit the project file yourself): http://fsprojectextender.codeplex.com/ (edit: old link was broken, updated to F# Project Extender home page which has links to the original blog posts which were moved) (which I found in this answer).

I do this myself, but it is cumbersome and you end up avoiding it until keeping sanity really demands it. I think the feature simply slipped, or perhaps there wasn't as much a culture for folder organization with the F# designers in the first place. You can see in the F# source code that they favor huge source files with no directories, with separate projects as an organization boundary.

I imagine the F# project template could be modified to support this, and it is certainly something I'd like to see happen. At the same time the linear compilation order F# enforces causes your code to be somewhat self-organized, and so folder grouping plays a less significant role.

like image 52
Stephen Swensen Avatar answered Oct 11 '22 18:10

Stephen Swensen