Open multiple Projects/Folders in Visual Studio Code

Visual Studio-Code

Visual Studio-Code Problem Overview


How do I open multiple projects/folders in a single Visual Studio Code instance, and open multiple files in single view? Does it has any option for future change request?

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

Not sure why the simplest solution is not mentioned. You can simply do File>New Window and open the other project in the new window.

Solution 2 - Visual Studio-Code

Update

This is now available out of the box as of October 2017. From the blog post:

> This was our #1 feature request - it's been a while coming but it's here now.

The complete documentation is here.

> You can work with multiple project folders in Visual Studio Code with multi-root workspaces. This can be very helpful when you are working on several related projects at one time. For example, you might have a repository with a product's documentation which you like to keep current when you update the product source code.


Original answer

Currently the Insider channel of VSCode gives us this out of the box.

Multi root workspace in vscode

Read more from the blog post.

Solution 3 - Visual Studio-Code

Update

As mentioned in several other answers here, this 'accepted' answer is outdated and is no longer correct. VS Code now has the concept of a 'workspace' which lets you add several 'root' folders to VS Code in the same window.

For instance, when working on a project in one folder that utilizes shared code held in a different folder, you can now open both the project folder and the shared folder in the same window.

To do this you use the Add folder to Workspace... command. VS Code then saves this configuration in a new file with a .code-workspace extension. If you double-click that file, VS Code will re-open with both folders present.

Original Accepted Answer (Outdated)

As described in The Basics of Visual Studio Code article:

"VSCode is file and folder based - you can get started immediately by opening a file or folder in VSCode."

This means the concept of solution and project files, like the .sln and .csproj, have no real function in VSCode other than that it uses these only to target and identify which language to support for Intellisense and such.

Simply put, the folder you open is the root you work with. But of course there is nothing from stopping you to open multiple windows.

As for the request features options, navigate to Help > Request Features which will redirect you to the UserVoice page of VSCode.

Solution 4 - Visual Studio-Code

Support for multi-root workspaces is now enabled by default in the latest stable release [November 2017 release].

The File > Add Folder to Workspace command brings up an Open Folder dialog to select the new folder.

enter image description here

Solution 5 - Visual Studio-Code

If you are using unix like OS, you can create a soft link to your target folder.

E.g. I want to see golang source while I am using VSCode. So, I create a soft link to go/src under my project folder.

ln -s /usr/local/go/src gosrc

Hope this helps!


Update: 11/28, 2017

Multi Root Workspaces[0] landed in the stable build, finally. https://code.visualstudio.com/updates/v1_18#_support-for-multi-root-workspaces

[0] https://github.com/Microsoft/vscode/issues/396

Solution 6 - Visual Studio-Code

You can open any folder, so if your projects are in the same tree, just open the folder beneath them.

Otherwise you can open 2 instances of Code as another option

Solution 7 - Visual Studio-Code

On Windows it's possible to use mklink to create directory symbolic links to the needed folders. Then keep them together in a folder, and VSCode will list the content of these.

    c:\>mklink /D c:\dev\MyWork\scripts c:\ProjA\scripts
    symbolic link created for c:\dev\MyWork\scripts <<===>> c:\ProjA\scripts

    c:\>mklink /D c:\dev\MyWork\styles c:\ProjB\styles
    symbolic link created for c:\dev\MyWork\styles <<===>> c:\dev\ProjB\styles

This is very similar to @NeilShen's idea, I guess.

Solution 8 - Visual Studio-Code

> October 2017 (version 1.18): > > Support for multi-root workspaces is now enabled by default in the Stable release: https://code.visualstudio.com/updates/v1_18#_support-for-multi-root-workspaces

Now we can open multiple folders in one instance, Visual studio code has named as Workspace ("Area de Trabajo"). Take a look at the images, it´s very simple.

enter image description here

enter image description here

Solution 9 - Visual Studio-Code

Multiple Folders in VS

>Click ->File ->Add Folder to Workplace.

Step 1.

enter image description here

>Choose which project to work ->Add(press)

Step 2.

enter image description here

Solution 10 - Visual Studio-Code

Or you can just select multiple folders and then click open.

Go to File> Open Folder, then select multiple folders you want to open and click Select Folder

Solution 11 - Visual Studio-Code

Just put your projects in the same folder and simply open that folder in vscode.

Now your projects will appear like:

GROUP OF PROJECTS

  • PROJECT 1

  • Contents

  • Contents

  • PROJECT 2

  • Contents

  • Contents

Solution 12 - Visual Studio-Code

It's not possible to open a new instance of Visual Studio Code normally, neither it works if you open the new one as Administrator.

Solution: simply right click on VS Code .exe file, and click "New Window" you can open as many new windows as you want. :)

Solution 13 - Visual Studio-Code

You can install the Open Folder Context Menus for VS Code extension from Chris Dias

https://marketplace.visualstudio.com/items?itemName=chrisdias.vscode-opennewinstance

  • Restart Visual Studio Code
  • Right click a folder and select "Open New Workbench Here"

Open New Workbench Here

Solution 14 - Visual Studio-Code

You can open up to 3 files in the same view by pressing [CTRL] + [^]

Solution 15 - Visual Studio-Code

What I suggest for now is to create symlinks in a folder, since VSCode isn't supporting that feature.

First, make a folder called whatever you'd like it to be.

$ mkdir random_project_folder
$ cd random_project_folder
$ ln -s /path/to/folder1/you/want/to/open folder1
$ ln -s /path/to/folder2/you/want/to/open folder2
$ ln -s /path/to/folder3/you/want/to/open folder3
$ code .

And you'll see your folders in the same VSCode window.

Solution 16 - Visual Studio-Code

you can create a workspace and put folders in that : File > save workspace as and drag and drop your folders in saved workspace

Solution 17 - Visual Studio-Code

You can use this extension known as Project Manager

In this the projects are saved in a file projects.json, just save the project and by pressing Shift + Alt + P you can see the list of all your saved projects, from there you can easily switch your projects.

Solution 18 - Visual Studio-Code

To run one project at a time in same solution

Open Solution explorer window -> Open Solution for Project -> Right click on it -> Select Properties from drop down list (Alt+Enter)-> Common Properties -> select Startup Project you will see "current selection,single selection and multiple selection from that select "Current Selection" this will help you to run one project at a time in same solution workspace having different coding.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionManish SapkalView Question on Stackoverflow
Solution 1 - Visual Studio-CodeRyan PergentView Answer on Stackoverflow
Solution 2 - Visual Studio-CodeJay WickView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeJuliënView Answer on Stackoverflow
Solution 4 - Visual Studio-CodeMuhsin KelothView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeNeilShenView Answer on Stackoverflow
Solution 6 - Visual Studio-CodeJohn PapaView Answer on Stackoverflow
Solution 7 - Visual Studio-CodeMax LevyView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeDaniel DelgadoView Answer on Stackoverflow
Solution 9 - Visual Studio-CodeafeefView Answer on Stackoverflow
Solution 10 - Visual Studio-CodeAnupam SinghView Answer on Stackoverflow
Solution 11 - Visual Studio-CodegmanousaridisView Answer on Stackoverflow
Solution 12 - Visual Studio-CodeHoma Pour MohammadiView Answer on Stackoverflow
Solution 13 - Visual Studio-CodephicoView Answer on Stackoverflow
Solution 14 - Visual Studio-CodephifiView Answer on Stackoverflow
Solution 15 - Visual Studio-CodeBirkhoff LeeView Answer on Stackoverflow
Solution 16 - Visual Studio-CodeHamidRezaView Answer on Stackoverflow
Solution 17 - Visual Studio-CodeGerma VinsmokeView Answer on Stackoverflow
Solution 18 - Visual Studio-CodeManish ShahView Answer on Stackoverflow