2014-04-03 43 views
14

在Visual Studio 2013,我的一個項目包括:Visual Studio F#項目:文件樹中不能同名的兩個文件夾?

<ItemGroup> 
    <Compile Include="Entity\Abstract\Entity.fs" /> 
    <Compile Include="Entity\HumanEntity.fs" /> 
    <Compile Include="State\Abstract\State.fs" /> 
    <Compile Include="State\Abstract\HumanState.fs" /> 
    <Compile Include="State\Human\HumanIdleState.fs" /> 
    <Compile Include="State\Human\HumanAwakenState.fs" /> 
</ItemGroup> 

的Visual Studio扼流圈這一點,聲稱:

The project 'Entity.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 'State\Abstract\State.fs'.

如果我改變包括像這樣,一切都很好:

<ItemGroup> 
    <Compile Include="Entity\AbstractEntity\Entity.fs" /> 
    <Compile Include="Entity\HumanEntity.fs" /> 
    <Compile Include="State\AbstractState\State.fs" /> 
    <Compile Include="State\AbstractState\HumanState.fs" /> 
    <Compile Include="State\Human\HumanIdleState.fs" /> 
    <Compile Include="State\Human\HumanAwakenState.fs" /> 
</ItemGroup> 

這是VS2013的疏忽,還是我做錯了,在這裏?

回答

10

不幸的是,這是Visual Studio中F#項目系統的限制。更詳細的分析可以在this article中找到。

Visual F# Power Tools的文件夾中組織即將到來的支持,我們要添加驗證,以防止用戶使用菜單項(見the coderelevant discussion)在一個項目中有重複的名稱添加文件夾。當然,我們不能通過編輯fsproj文件來阻止用戶這樣做。

也許你可以在microsoft.com上向fsbugs發送一個建議,以便它可以在即將發佈的Visual F#Tools版本中修復。

+5

屁股屁股。謝謝。 – MiloDC

2

這裏是我目前使用的是什麼來解決這個限制:

說你依賴於外部庫(如引導等 - F#是在網上的東西出奇地好,太)是組織他們的文件進入恰好具有重複文件夾名稱的文件夾層次結構。

可以保留該文件夾結構如果您更改具有相同名稱的文件夾的大小寫。 例如,這個工作(你可以擴展這個模式,如果文件夾名稱允許有足夠的資本組合)

以下文件夾結構:

字體\引導... 樣式\引導... JavaScript的\引導...

可以包括在像這樣的F#項目(標記的內容僅僅是一個例子,也可以是無等等):

<Content Include="fonts\bootstrap\glyphicons-halflings-regular.eot" /> 
... 
<Content Include="javascripts\Bootstrap\affix.js" /> 
... 
<Content Include="stylesheets\BOotstrap\_alerts.scss" /> 
... 

...等等。

上述樣品中的相關位:b ootstrap與 ootstrap與BO otstrap。

之後的一切工作。我認爲它不適用於區分大小寫的文件系統,除非你也使用實際的文件夾名稱。

相關問題