Manish Sapkal
Manish Sapkal

Reputation: 6251

Open multiple Projects/Folders in Visual Studio Code

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?

Upvotes: 424

Views: 385405

Answers (22)

user2789155
user2789155

Reputation: 3

Ok dont know if this is still active or not, but now there is an option of adding folder to the existing workspace. File > Add Folder to Workspace

Upvotes: 0

Ahsan Ali
Ahsan Ali

Reputation: 391

You can simply add folders in your workspace by clicking: File -> Add Folder to Workspace and choose as many folders as you want in your VScode workspace.

Upvotes: 2

takobaba
takobaba

Reputation: 314

You can use the terminal via code command to open multi folder workspace:

code <folder1> <folder2> <folder3>

Above command will launch a new VSCode window with 3 folders.

Upvotes: 0

user6600615
user6600615

Reputation: 19

Had a similar problem trying to keep my "Lessons Learned" github current, as I would figure something out working on a project. After bouncing around various posts, and creating multiple workspaces, I currently just go Window-->New Tab, and open away Hope that helps.

Upvotes: 1

Jay Wick
Jay Wick

Reputation: 13797

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.

Upvotes: 276

Manish Shah
Manish Shah

Reputation: 1

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.

Upvotes: 0

Juli&#235;n
Juli&#235;n

Reputation: 9572

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.

Upvotes: 182

afeef
afeef

Reputation: 4716

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

Upvotes: 11

Muhsin Keloth
Muhsin Keloth

Reputation: 7964

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

Upvotes: 38

Anupam Singh
Anupam Singh

Reputation: 51

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

Upvotes: 4

Germa Vinsmoke
Germa Vinsmoke

Reputation: 3759

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.

Upvotes: 0

HamidReza
HamidReza

Reputation: 1934

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

Upvotes: 1

NeilShen
NeilShen

Reputation: 558

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

Upvotes: 24

Daniel Delgado
Daniel Delgado

Reputation: 5343

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

Upvotes: 9

Ryan Pergent
Ryan Pergent

Reputation: 5376

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.

Upvotes: 393

phico
phico

Reputation: 1403

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

Upvotes: 3

Homa
Homa

Reputation: 132

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. :)

Upvotes: 3

Birkhoff Lee
Birkhoff Lee

Reputation: 870

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.

Upvotes: 1

gmanousaridis
gmanousaridis

Reputation: 373

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

Upvotes: 4

Max Levy
Max Levy

Reputation: 404

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.

Upvotes: 12

phifi
phifi

Reputation: 3028

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

Upvotes: 1

John Papa
John Papa

Reputation: 22338

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

Upvotes: 17

Related Questions