我在同一個問題上掙扎。主要問題,已將文件鏈接到項目DEBUG配置。所以當您切換到RELEASE配置時,鏈接仍然存在,現在您的項目中有重複的定義。 obj/DEBUG路徑中的visible和obj/RELEASE路徑中的invisibles我不知道在VS-GUI上解決這個問題的任何解決方案。但它有可能修補cproj文件,以獲得可接受的解決方案:
首先是原單部分:
...
<ItemGroup>
<Compile Include="DataRepository.cs" />
<Compile Include="SpreadsheetErrorListener.cs" />
<Compile Include="SpreadsheetVisitor.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="obj\Debug\SpreadsheetBaseListener.cs" />
<Compile Include="obj\Debug\SpreadsheetBaseVisitor.cs" />
<Compile Include="obj\Debug\SpreadsheetLexer.cs" />
<Compile Include="obj\Debug\SpreadsheetListener.cs" />
<Compile Include="obj\Debug\SpreadsheetParser.cs" />
<Compile Include="obj\Debug\SpreadsheetVisitor.cs" />
</ItemGroup>
...
此致應該類似。
我分裂它ItemGroups這樣:
...
<ItemGroup>
<Compile Include="DataRepository.cs" />
<Compile Include="SpreadsheetErrorListener.cs" />
<Compile Include="SpreadsheetVisitor.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Compile Include="obj\Release\SpreadsheetBaseListener.cs" />
<Compile Include="obj\Release\SpreadsheetBaseVisitor.cs" />
<Compile Include="obj\Release\SpreadsheetLexer.cs" />
<Compile Include="obj\Release\SpreadsheetListener.cs" />
<Compile Include="obj\Release\SpreadsheetParser.cs" />
<Compile Include="obj\Release\SpreadsheetVisitor.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Compile Include="obj\Debug\SpreadsheetBaseListener.cs" />
<Compile Include="obj\Debug\SpreadsheetBaseVisitor.cs" />
<Compile Include="obj\Debug\SpreadsheetLexer.cs" />
<Compile Include="obj\Debug\SpreadsheetListener.cs" />
<Compile Include="obj\Debug\SpreadsheetParser.cs" />
<Compile Include="obj\Debug\SpreadsheetVisitor.cs" />
</ItemGroup>
...
在VS兩個目錄是可見的,但只有一個是用於智能感知和編譯過程。
當前所選的文件與「歎爲觀止」(抱歉不知道正確的名稱)
DEBUG configuration
RELEASE configuration
顯示不看不錯,但解決問題。
缺點:
每次添加新的配置,就必須重新修補cproj文件。但這樣做是值得的,因爲Intellisense,Resharper和所有其他漂亮的小幫手都可以工作。