Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open two instances of a file in a single Visual Studio session

I have a file, xyz.cpp. I want to open two instances of this file in Visual studio (BTW, I am using Visual Studio 2005). Why would I want to do so? I want to compare two sections of the same file side by side. I know workarounds such as:

  1. Make a copy of the file. But the problem is that it's not elegant, and I don't want to make copies every time I am faced with this.

  2. I can split the window into two. The problem with split it that I can split it horizontally only. The result of a horizontal split is that the right half of my screen is white space.

If I were able to split it vertically or open two instances of the same file, it would increase the number of lines of code I can compare.

like image 682
Paragon Avatar asked Apr 08 '09 07:04

Paragon


People also ask

How do I open multiple instances of Visual Studio?

Use "Ctrl + Alt + D" to open multiple instances.

How do I open two windows of the same File in Visual Studio?

In the VS 2017, I can go Window->New Window to open the same file in left and right vertical tab.

How do I open two projects at the same time in Visual Studio Code?

You can simply do File>New Window and open the other project in the new window. Because after you close VSCODE and launch it again it opens only one of these two windows. But with workspace you keep both.

How do I open files side by side in Visual Studio?

Open to the Side (Ctrl+Enter) from the Explorer context menu on a file. Click the Split Editor button in the upper right of an editor. Drag and drop a file to any side of the editor region.


1 Answers

Here's how to do it...

  1. Select the tab you want two copies of
  2. Select menu WindowNew Window from the menu.
  3. Right click the new tab and select New Vertical Tab Group

If New Window is not listed in the *Window menu note that the command does exist, even as of Visual Studio 2017. Add it to the Window menu using menu ToolsCustomizeCommands. At that point decide where to put the New Window command and select Add Command.

UPDATED on "30 July 2018"

In Visual Studio Code version 1.25.1 and later

Way 1

You can simple left click on your file in the side-panel (explorer) and press Ctrl + Enter.

Way 2

Simply right click on your file in the Visual Studio Code side-panel (explorer) and select the first option open to the side.

like image 187
PaulB Avatar answered Oct 09 '22 17:10

PaulB