Visual Studio macro to group files
Visual Studio has the concept of grouping files together a feature used mainly from code generation tools to groups generated files under the main file, but this feature can be used even for your class, as shown in Figure1.
Figure 1 : Two code files nested inside program.cs
There are a lot of reasons to group files togheter, you can use this technique for group partial classes definition or you can simply want to group logically related files, etc etc. The annoying stuff is that there is no menu in Visual Studio that permits you to obtain this result, but you can solve everything with a macro. Just open the Visual Studio Macro IDE and insert the following macro.
|
|
This is far from being called production code ready, but it does its dirty work, just assign a shortcut to this macro from the Tools->Customize menu (I’ve used CTRL+G, CTRL+R), then you should select all the files you want to group together and press the shortcut, the macro will show you a dialog that permits you to choose which is the file to be used as root, as shown in Figure2
Figure 2 : The macro is showing you the list of selected files to choose the root file
Just select Program.cs and press ok and the files will be grouped together as shown in Figure1.
Gian Maria