Visual Studio Development Bookmark and Share   
 index > Visual Studio Setup and Installation > show partial class file indented in Solution Explorer like .Designer.cs does
 

show partial class file indented in Solution Explorer like .Designer.cs does

I would like my partial class files to display indented under the first file that declares that partial class.  Just like the Form1.Designer.cs file is indented under the Form1.cs file.

I see this post in the forum addresses my question. http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/74537979-5f25-43c9-b6bd-a31eab04ddde  Can someone elaborate on the last post in that thread.  Do I have to manually edit a project file to do this?

thanks,
SteveRichter  Wednesday, October 14, 2009 12:19 PM
Hi Steve

The solution can be to add a node <DependentUpon> in the project file under the "Class1.cs" (where the partial class definition resides).

For example before the change the project.csproj looks like:

... ...
  <ItemGroup>
    <Compile Include="Class1.cs" />
    <Compile Include="CodeFile1.cs"/>
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
... ...
And after changes it's like:
... ...  
<ItemGroup>
  <Compile Include="Class1.cs" />
  <Compile Include="CodeFile1.cs">
    <DependentUpon>Class1.cs</DependentUpon>
  </Compile>
  <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
... ...
Then you will see that CodeFile1.cs is indented under the Class1.cs.

Before doing the changes, I'd recommend you to apply the small tip in the Visual Studio that can facilitate the job: http://blogs.msdn.com/saraford/archive/2008/10/10/did-you-know-how-to-edit-a-csproj-or-vbproj-project-file-within-the-ide-332.aspx

If there is anything unclear, please feel free to let me know.

Thanks.

Figo Fei

MSDN Subscriber Support in Forum

If you have any feedback on our support, please contact msdnmg @ microsoft.com


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Marked As Answer bySteveRichter Friday, October 16, 2009 9:06 PM
  •  
Figo Fei  Thursday, October 15, 2009 4:21 AM
Hi Steve

The solution can be to add a node <DependentUpon> in the project file under the "Class1.cs" (where the partial class definition resides).

For example before the change the project.csproj looks like:

... ...
  <ItemGroup>
    <Compile Include="Class1.cs" />
    <Compile Include="CodeFile1.cs"/>
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
... ...
And after changes it's like:
... ...  
<ItemGroup>
  <Compile Include="Class1.cs" />
  <Compile Include="CodeFile1.cs">
    <DependentUpon>Class1.cs</DependentUpon>
  </Compile>
  <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
... ...
Then you will see that CodeFile1.cs is indented under the Class1.cs.

Before doing the changes, I'd recommend you to apply the small tip in the Visual Studio that can facilitate the job: http://blogs.msdn.com/saraford/archive/2008/10/10/did-you-know-how-to-edit-a-csproj-or-vbproj-project-file-within-the-ide-332.aspx

If there is anything unclear, please feel free to let me know.

Thanks.

Figo Fei

MSDN Subscriber Support in Forum

If you have any feedback on our support, please contact msdnmg @ microsoft.com


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Marked As Answer bySteveRichter Friday, October 16, 2009 9:06 PM
  •  
Figo Fei  Thursday, October 15, 2009 4:21 AM

You can use google to search for other answers

Custom Search

More Threads

• Error with VC# 2008 EE
• View MSDN Library in VS2005 over a Network Share
• Unable to install VS Extensions for .NET 3.0 , November 2006 CTP
• Changing programming language
• VS 2008 - Crash on exit
• Different length of the MSI file in XP X Vista
• VS2005-Pro Trial to VS2005 Std. license
• Expiration date
• Can I install visual studio 2008 without the SQLexpress edition and use instead the SQL Server 2005 Developer Edition?
• vhost.exe will be generated when I use some .NET Framework 1.1 DLL