3

I created a new project in Visual Studio 2013 using the F# ASP.NET MVC 5 and Web API 2, available here, but I got mine on Nuget.

The template sets up a directory called Content for CSS files, and another called Scripts for JavaScript files. In each of those directories, I created subdirectories and put files in them. Now, when I try to reopen the project after closing it, I get the following error:

The project 'PROJECTNAME.fsproj' could not be opened because opening it would cause a folder to be rendered multiple times in the solution explorer. One such problematic item is'Content\Widgets\jQueryIO\v_1_10_4\Lightness\jquery-ui-1.10.4.custom.min.css'. To open this project in Visual Studio, first edit the project file and fix the problem.

The lines in the fsproj file in question are shown below:

    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\jquery-ui-1.10.4.custom.min.css" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\animated-overlay.gif" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-bg_diagonals-thick_18_b81900_40x40.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-bg_diagonals-thick_20_666666_40x40.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-bg_flat_10_000000_40x100.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-bg_glass_100_f6f6f6_1x400.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-bg_glass_100_fdf5ce_1x400.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-bg_glass_65_ffffff_1x400.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-bg_gloss-wave_35_f6a828_500x100.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-bg_highlight-soft_100_eeeeee_1x100.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-bg_highlight-soft_75_ffe45c_1x100.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-icons_222222_256x240.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-icons_228ef1_256x240.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-icons_ef8c08_256x240.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-icons_ffd27a_256x240.png" />
    <None Include="Content\Widgets\jQueryUI\v_1_10_4\Lightness\images\ui-icons_ffffff_256x240.png" />

The only reference to the problem that I have been able to find is the following link:

http://cs.hubfs.net/topic/None/60049

The solution there mentions that I should "reorder the files so that all the files of each folder are together." Can someone please give me an example of this reordering?

Thanks in advance.

EDIT

I have made sure that all the file paths are adjacent to each other in the None and Content nodes, as suggested at the link above ,but the problem still persists.

Shredderroy
  • 2,860
  • 2
  • 29
  • 53
  • The only workaround that I have been able to find has been to not create sub-folders in `Scripts` and `Content`. This is problematic with respect to organizing the files neatly, but will have to do for now, I guess. – Shredderroy Feb 08 '14 at 23:19
  • Can you post the full project file somewhere that we could take a look at? – JaredPar Feb 09 '14 at 01:44
  • @JaredPar, I have posted the `fsproj` file at Dropbox. Please view it at https://www.dropbox.com/s/73lekvalvieqtmi/Test.fsproj. Thanks! – Shredderroy Feb 09 '14 at 05:13
  • The problem appears to be easily reproducible. It occurs quite reliably anytime a directory is added to either `Scripts` or `Content`. It also occurs whenever a JavaScript or CSS file is moved up or down in Solution Explorer. Strange that the `F# C# MVC 4` template does not have this problem. (I would prefer to use a pure F# solution.) – Shredderroy Feb 09 '14 at 08:51

2 Answers2

1

Unfortunately Visual Studio does not support folders in F# projects. To add files to sub folders, you have to manually edit the .fsproj file using a text editor.

For more discussion on the problem, see this thread

UPDATE

The F# Power Tools addin for Visual Studio now has support for folder organization.

Community
  • 1
  • 1
John Atwood
  • 1,505
  • 10
  • 19
  • Note that, even with that addon, you can still receive this error if two compilable files in separate folders have the same name. Prior to that add on, F# already supported folders but you needed to edit the FSPROJ files manually. With the tool you can manage it in the front-end with context-sensitive right-click menus. – Abel Oct 30 '14 at 14:20
1

If this can help :

I've just encountered this error message after adding 2 NuGet packages to a F# library project. First package dlls went into x86 and the second ones into dll/x86 so 2 different directories

The common 'x86' in both paths (but not at the same level) was the problem. Renaming one, putting everything in the same directory or organizing subdirectories so same names are always at same level fixed problem for me.

As it is If I had to guess putting 'contents' and 'scripts' as last subdirectory of the listed paths would not cause this message to occur.

Edel
  • 11
  • 2