Collapsing Related Files in Visual Studio - visual-studio

In Visual Studio as most of you will have noticed that related file can be collapsed in to one. E.G.
Form1.cs
Form1.Designer.cs
I'm creating a DAL library and will be splitting partial classes in to several files such as:
SomeTableClass.cs
SomeTableClass.Generated.cs
SomeTableClass.SomethingElse.cs
Is there any way in Visual Studio to recognise these file are related to each other an create the collapsible effect?
Thanks
Tony

In my (VisualStudio 2005) system, they are stored in the registry under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{E24C65DC-7377-472B-9ABA-BC803B73C61A}\RelatedFiles
For VisualStudio 2008, change the \8.0\ to \9.0\
Note, however, that the GUID in the middle refers to the type of project (VB Console, C# Web, etc) it is. You may have to poke around to find the right one for you.

In VS 2008, there is also a project file-level way to do this via the DependentUpon tag. You would edit your project file to look like this:
<Compile Include="SomeTableClass.cs" />
<Compile Include="SomeTableClass.Generated.cs">
<DependentUpon>SomeTableClass.cs</DependentUpon>
</Compile>

In my Windows 7 x64 environment, the registry keys for Visual Studio 2008 Professional are located here:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Projects\{E24C65DC-7377-472B-9ABA-BC803B73C61A}\RelatedFiles

In Visual Studio 2012, they are to be found in the HKCU, i.e.:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\{E24C65DC-7377-472B-9ABA-BC803B73C61A}\RelatedFiles

A useful VS plugin has since popped up that takes care of this problem for me: NestIn

Related

Loading Visual Studio 12 project in Visual Studio 10 [duplicate]

My teacher is complaining that he can't read the VS2012 format on his VS2010 environment. I looked around in settings and so on but couldn't find anything. How can I give the project in an VS2010 readable format to my teacher?
Modifying sln manually
Backup your project folder (copy/paste to another location, like a folder called "backups")
Open sln file on wordpad
Change the "header" of opened sln to below (the first lines that matches mentioned lines below, except by version number/name):
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
I'll see if there is a way to do it in project options...
If the VS2010 installation has SP1 installed, then it should be able to read the VS2012 solution file.
Assuming this is not a terribly complex project (I'm making that assumption since there is a teacher involved), the easiest approach may be just to re-create the project in Visual Studio 2010.
Fire up VS2010, add your files, make any necessary changes to settings, and save.
You will need VS2010 no matter what approach you take. Even if you convert the project file by other means, it would be very wise to test it before handing it in again. The Express edition is free.
Another easy way to do it is to right click on the source code, open it with a program such as notepad, then save that on to a USB stick. When you go to class, copy and paste this into Visual Studio 2010 and viola.

Export Visual Studio 2012 to 2010 sln format

My teacher is complaining that he can't read the VS2012 format on his VS2010 environment. I looked around in settings and so on but couldn't find anything. How can I give the project in an VS2010 readable format to my teacher?
Modifying sln manually
Backup your project folder (copy/paste to another location, like a folder called "backups")
Open sln file on wordpad
Change the "header" of opened sln to below (the first lines that matches mentioned lines below, except by version number/name):
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
I'll see if there is a way to do it in project options...
If the VS2010 installation has SP1 installed, then it should be able to read the VS2012 solution file.
Assuming this is not a terribly complex project (I'm making that assumption since there is a teacher involved), the easiest approach may be just to re-create the project in Visual Studio 2010.
Fire up VS2010, add your files, make any necessary changes to settings, and save.
You will need VS2010 no matter what approach you take. Even if you convert the project file by other means, it would be very wise to test it before handing it in again. The Express edition is free.
Another easy way to do it is to right click on the source code, open it with a program such as notepad, then save that on to a USB stick. When you go to class, copy and paste this into Visual Studio 2010 and viola.

Visual studio autoexp.dat alternative?

Custom debug visualization in visual studio:
Is there any way to do it per project instead of editing the "global" autoexp.dat?
Would be nice if it tagged along when changing workstation..
No: per-project (or per-user) visualizers in Visual Studio 2010 (C++ native) are not possible. Visual Studio 2012 added this feature; it is based on "natvis" XML files.
Rather old question, but lets give my cent:
For VS2008 SP1 and VS2010 you have the alternative to use your custom file, instead of invasively edit the native autoexp.dat file using the _vcee_autoexp environment variable.
Credit to: https://vtk.org/Wiki/ITK/Debug_Visualizers_for_Visual_Studio
Note: I have not tried, but maybe using a relative path VS loads it based on the solution folder. Alternatively I would also try using multiple path separated with semicolons. Just give it a try.

How to let Visual Studio to add references according to USINGS?

I realized that when dividing a project into two in Visual Studio (2010) I'm still looking for references that are missing in the new project. Can Visual Studio do that for me? It can find all the namespaces I use so it should be easy for it.
Thanks!
There isn't any built-in way to do this. However, you may want to check out the PowerCommands extension which gives you a "Copy Reference" command to quickly copy/paste assembly references between projects.

Creating registerable Visual Studio packages

I'm creating a single file generator for Visual Studio (similar to the LINQ to SQL/ LINQ to Entities generators). I've follewed the example in the Visual Studio 2008 SDK (http://code.msdn.microsoft.com/sfgdd), but I've hit a snag with regpkg, I can't work out how to get it working.
I can't find any good example of how it needs to be done, the examples seem to think I have a .reg file already, but I don't know what I need in the .reg to do it.
Can someone fill in the gap in the examples documentation?
I've managed to solve the problem, using an Installer project within Visual Studio to set up the registry keys. In addition to that you need to have the DLL installed into the GAC.
I'll be doing a series on my blog which covers this, starting with the registry keys: http://www.aaron-powell.com/blog/june-2009/creating-an-installer-for-a-single-file-generator---part-1.aspx

Resources