2008-10-21 5 views
7

Visual Studio에서 솔루션에 새 Windows Form을 만들 때 (예 : MyForm.cs를 만들면 MyForm.Designer.cs 및 MyForm.resx도 만들어 짐) 두 개의 파일이 만들어집니다. 두 번째 두 파일은 솔루션 탐색기에서 하위 트리로 표시됩니다.Visual Studio에서 .Designer.cs 파일 옆에있는 파일을 만들 수 있습니까?

Windows Form 클래스의 하위 트리 또는 그룹에 파일을 추가 할 수있는 방법이 있습니까?

답변

14

열기 .csproj, 당신은 다른 아래로 원하는 파일을 찾아,이처럼 DependentUpon 요소를 추가 :

<Compile Include="AlertDialog.xaml.cs"> 
    <DependentUpon>AlertDialog.xaml</DependentUpon> 
</Compile> 
+0

FileNesting 확장은 자동으로 그렇게 할 수 있습니다 : https://marketplace.visualstudio.com/items?itemName=MadsKristensen.FileNesting – John

6

csproj를 직접 편집해야합니다. MyForm.cs 아래에 배치 할 파일의 하위 태그로 추가해야하는 DependentUpon 태그가 있습니다.

예 : 편집 모드에서

<Compile Include="MyForm.MyCoolSubFile.cs"> 
    <DependentUpon>MyForm.cs</DependentUpon> 
</Compile> 
4

예, 하지만 약간의 번거 로움 - 기본적으로 손으로 프로젝트 파일을 편집해야합니다.

가 여기에 프로젝트의 예입니다 그 마크 Gravell와 나는 일에 :

<Compile Include="Linq\Extensions\DataProducerExt.cs" /> 
<Compile Include="Linq\Extensions\DataProducerExt.SingleReturn.cs"> 
    <DependentUpon>DataProducerExt.cs</DependentUpon> 
</Compile> 
<Compile Include="Linq\Extensions\DataProducerExt.Grouping.cs"> 
    <DependentUpon>DataProducerExt.cs</DependentUpon> 
</Compile> 
<Compile Include="Linq\Extensions\DataProducerExt.Pipeline.cs"> 
    <DependentUpon>DataProducerExt.cs</DependentUpon> 
</Compile> 
<Compile Include="Linq\Extensions\DataProducerExt.Conversion.cs"> 
    <DependentUpon>DataProducerExt.cs</DependentUpon> 
</Compile> 
<Compile Include="Linq\Extensions\DataProducerExt.Math.cs"> 
    <DependentUpon>DataProducerExt.cs</DependentUpon> 
</Compile> 

주 의존성의 각에서 "DependentUpon"요소입니다. VS에서 DataProducerExt.cs를 부모로 적절하게 표시합니다.

관련 문제