F# folder rendered multiple times

I was recently testing the ASP.MVC 5 F# template, which works fine but almost always breaks down as soon as you add new item to the solution. F# has hard time with folders. The problem has been described here . And as soon as you add new file to the F# project you will run to the same problem and the next time, you won’t be able to load the project file with:

The project '...' could not be opened because opening it would cause a folder to be rendered multiple times in the solution explorer.

The suggestion proposed solution si to forgot the nested folders and just rename the files, but there is a better way around. Here is the problem:

<Content Include="Views\Web.config" />
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Home\PayoffCharts.cshtml" />

In real F# can handle nested folders, but all files in the same folder have to be consecutive in the items group. This will fix the problem:

<Content Include="Views\Web.config" />
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Views\Home\PayoffCharts.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />

Note that the same applies for any nested level. The following would not work, because thoug all items in Shared folter are aligned, the items in the Another subfolder are not.

<Content Include="Views\Home\PayoffCharts.cshtml" />
<Content Include="Views\Shared\Another\_Layout.cshtml" />
<Content Include="Views\Shared\Test2\_Layout.cshtml" />
<Content Include="Views\Shared\Another\_Layout.cshtml" />
Written on September 17, 2015