5

In Visual Studio 2008 you could add registry entries so that X.aspx.js or X.aspx.css would show up as nested underneath X.aspx. I would use the following registry file to accomplish this for web sites as well as web apps:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.js]
@=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.css]
@=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\RelatedFiles\.aspx]
".designer.cs"=dword:00000002
".cs"=dword:00000002
".js"=dword:00000002
".css"=dword:00000002

I replaced 9.0 with 10.0 and applied the changes to my registry, but that's didn't do it. I have restarted VS as well as my computer, and I've also tried readding the files in question to my web project. I searched around online and found a few people asking about the same thing but no definite solution (link1 link2).

Does anyone know how to get files to nest in 2010?

Polshgiant
  • 3,595
  • 1
  • 22
  • 25

4 Answers4

4

This post applies to VISUAL STUDIO 2010 only.

You will find below the registry entries for VB and C# (apps and web sites). It will nest xxx.xxx.js under the related file as per illustration below.

Javascript nesting - Solution Explorer

Important

  • You must add the suffix *.aspx.js, otherwise it won't work.
  • Existing script files in your project will not be nested under the related file. It only applies to new script files added after the registry changes.

To change the Registry

  • Highlight the entire content from the grey area below, copy and paste into Notepad.
  • Save the file to your desktop as VSRegistry.reg, then close Notepad.
  • Right-click VSRegistry.reg on your desktop, then choose Merge from the popup menu.
  • Voila', you can now launch Visual Studio 2010 and try adding a new javascript file.

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx]
"RelationType"=dword:00000002
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.cs]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.css]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.js]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.vb]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.xml]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.xslt]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{F184B08F-C81C-45f6-A57F-5ABD9991F28F}\RelatedFiles\.ascx]
".designer.vb"=dword:00000002
".cs"=dword:00000002
".js"=dword:00000002
".css"=dword:00000002
".xslt"=dword:00000002
".xml"=dword:00000002
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\RelatedFiles\.ascx]
".designer.cs"=dword:00000002
".cs"=dword:00000002
".js"=dword:00000002
".css"=dword:00000002
".xslt"=dword:00000002
".xml"=dword:00000002
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx]
"RelationType"=dword:00000002
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.cs]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.css]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.js]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.vb]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.xml]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.xslt]
@=""
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{F184B08F-C81C-45f6-A57F-5ABD9991F28F}\RelatedFiles\.aspx]
".designer.vb"=dword:00000002
".cs"=dword:00000002
".js"=dword:00000002
".css"=dword:00000002
".xslt"=dword:00000002
".xml"=dword:00000002
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\RelatedFiles\.aspx]
".designer.cs"=dword:00000002
".cs"=dword:00000002
".js"=dword:00000002
".css"=dword:00000002
".xslt"=dword:00000002
".xml"=dword:00000002
Richard H
  • 300
  • 7
  • 15
3

Here's the registry file if anyone wants it. It'll nest files for C# web apps and web sites. Shut down all instances of VS before importing.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx]
"RelationType"=dword:00000002

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.cs]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.css]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.js]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.vb]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.xml]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.xslt]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\RelatedFiles\.ascx]
".designer.cs"=dword:00000002
".cs"=dword:00000002
".js"=dword:00000002
".css"=dword:00000002
".xslt"=dword:00000002
".xml"=dword:00000002

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx]
"RelationType"=dword:00000002

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.cs]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.css]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.js]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.vb]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.xml]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.xslt]
@=""

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\RelatedFiles\.aspx]
".designer.cs"=dword:00000002
".cs"=dword:00000002
".js"=dword:00000002
".css"=dword:00000002
".xslt"=dword:00000002
".xml"=dword:00000002
Polshgiant
  • 3,595
  • 1
  • 22
  • 25
2

Looks like VS2010 settings are per "user" and not "per machine" D'oh!

So search in the HKEY_USERS until you'll find your user's settings.

DATEx2
  • 3,585
  • 1
  • 24
  • 26
0

Apparently, there is also some manual editing you can do to the project XML file to achieve this.

Example:

<Content Include="Default.js">
    <DependentUpon>Default.aspx</DependentUpon>
</Content>

Source: http://davefancher.com/2012/02/23/nesting-files-in-visual-studio/

Barett
  • 5,826
  • 6
  • 51
  • 55