Possible Duplicate:
Group files in Visual Studio
The problem is, that I want to group partial class files in a way in the Solution Explorer, that visual Studio displays a [+] in front of the filename which I than can expand to see all other dependant files.
But my classes are shown in two rows below each other:
> CustomerServiceDao.cs > CustomerServiceDao.Query.cs
The result I want to have is something like that.
+ CustomerServiceDao.cs > CustomerServiceDao.Query.cs
Is there any naming convention which I have to follow in order to show the partial files grouped?
It works. That's great. But are there any naming conventions? e.g. ascx does it by default ...
Any method, interface, and function declared on a partial class is available for all the other parts. The source file name for each part of the partial class can be different, but each partial class's name must be the same.
That is, any file with the same name and extension as another file plus an additional extension on the end is nested under the other file.
Open Visual Studio from "Start" -> "All programs" -> "Microsoft Visual Studio". Then, go to "File" -> "New" -> "Project..." then select "Visual C#" -> "Windows" -> "Console application". Then, specify the name such as Partial class or whatever name you wish and the location of the project and click on the "OK" button.
If you open your .csproj
as a text file (or choose "Unload Project" from the context menu in Solution Explorer for the project, followed by "Edit myproject.csproj") you can change it to show the relevant files in Solution Explorer in the style you wish.
Look for:
<Compile Include="CustomerServiceDao.cs" /> <Compile Include="CustomerServiceDao.Query.cs" />
And edit it to be as this:
<Compile Include="CustomerServiceDao.cs" /> <Compile Include="CustomerServiceDao.Query.cs"> <DependentUpon>CustomerServiceDao.cs</DependentUpon> </Compile>
There's no way to do this directly within the Visual Studio editor, but given the extensibility model that VS2k10 provides, it probably won't be long before someone produces something.
Update: The latest version of VSCommands claims to support doing this for you:
Latest version supports grouping items from IDE (so you don't have to hand-hack project file with DependentUpon).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With