We are creating a series of classes that will be code generated, but
customizeable by the end user. (we'll use partial classes, where one file is
generated and the other is user-editable).
Since these files will always come in pairs, it would be really nice if I
could group them in the solution explorer, sort of the way that components
or forms are grouped (where you have a parent node, and the child nodes are
code files).
How would I set about doing this? I have snooped around at the
DesignerCategoryAttribute, and I think I'm getting close, but I haven't
quite cracked the code yet.
WenYuan Wang [MSFT] - 22 Jun 2007 06:10 GMT
Hello J.Marsch,
According to your description, I understand you want to group partial class
just as components or forms does in VS 2005 IDE.
This is a common issue. I'm pretty sure there is no way to do it in UI.
However, it is possible to do by editing the .csproj file directly. In
.csproj file, the value of "DependentUpon" is the file which should be
shown as the parent in solution explorer.
Such as:
<Compile Include="Fun1.1.cs">
<DependentUpon>Fun1.cs</DependentUpon>
</Compile>
You will notice something as below in solution explorer.
Fun1.cs
- Fun1.1.cs
For more information, you may refer to:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=642782&SiteID=1
[grouping partial class files like the designer does]
http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/brow
se_thread/thread/554ac3dfbfeda5ac/00143d709269dd02?lnk=st&q=Why+don%27t+part
ial+class+files+group%3F+&rnum=1&hl=zh-CN#00143d709269dd02
[Why don't partial class files group? ]
Hope this helps.
Sincerely,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
WenYuan Wang [MSFT] - 22 Jun 2007 06:26 GMT
Hi J.Marsch,
BTW, please don't forget to backup your .csproj file before you wan to edit
it.
Thanks.
Sincerely,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.