7

In VS2013 I want to view the same cshtml file in 2 windows side by side (i.e. vertical split). I know how to do a horizontal split but that's not what I'm after here.

The usual approach is to duplicate the tab (WINDOW, New Window) for the file and then create a new vertical tab group.

However, I cannot find a way to duplicate a cshtml tab, since the New Window menu item is disabled for that file type.

It works fine for .cs and even .js files. I tried to assign a key combo for Window.NewWindow, but it still won't work for cshtml files.

Any suggestions?

Harald
  • 1,007
  • 1
  • 14
  • 27
  • It is a bit hacky but it works. Change the filename from sth.cshtml to sth.cs, then delete all the content so it would be just an empty file. Save it. Now the new window is available. Arrange the two windows however you want. Then paste back the original content and rename back the file to sth.cshtml. This way you will have to open windows of it. – Yoghurt Dec 09 '13 at 15:20
  • Thanks Yoghurt. However, I am looking for a much simpler solution (and hoping there is one)! The procedure you outline is way too involved for a quick side by side... – Harald Dec 09 '13 at 21:00

1 Answers1

19

To enable "New Window" for cshtml you can change "Single Code Window Only" from 1 to 0 in the registry key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Languages\Language Services\HTMLX.

It was probably disabled for a reason and changing 12.0_Config is prone to overwrites on next VS update, but you can try how it works.

Sergey Vlasov
  • 26,641
  • 3
  • 64
  • 66
  • That worked! Thanks Sergey. Where did you get this info from? Are there more such tips where this one came from? – Harald Dec 10 '13 at 06:48
  • The "Single Code Window Only" value is mentioned here: http://stackoverflow.com/questions/728949/open-two-instances-of-a-file-in-single-visual-studio-session – Sergey Vlasov Dec 10 '13 at 14:40
  • 5
    Also works for VS 2015 - just use this registry key: `HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0_Config\Languages\Language Services\HTMLX`. Note you have to restart VS for this to be picked up. – Jarrod Dixon Nov 04 '15 at 03:39