In this VS code tutorial, we will discuss what is a visual studio workspace. How to create a workspace in vs code? Also, we will see how to add a folder to a workspace in visual studio code and how to Open and Close a workspace.
What is visual studio code workspace
- A Visual Studio Code workspace can contain multiple files and folders. It allows customizing the settings and preferences of a workspace.
- A VS Code workspace contains one or more root folders with a configurations file (.code-workspace)
- .code-workspace is a JSON file contains configuration information with the location of all root folders belonging to a workspace.
How to create a workspace in visual studio code
Now, let us see how to create a workspace in vs code.
Here, first I have created few folders in my E drive. It looks like below:
Now Open visual studio code, then go to File -> Open Folder…
Then select the Development folder like below:
Now click on File -> Save Workspace As…
Then you can provide a name for the workspace like below, click on Save.
Now, you can see in the VS code, the workspace will reflect like below:
If you will open the physical file location, you can see the file got created.
You can open the code workspace file in a notepad also. You can see it contains the path of the folder and also settings section.
This is just a JSON file.
Anytime you can double click on the file to open the workspace in visual studio code.
This is how we can create a workspace in vs code.
How to add a folder to a workspace in visual studio code
Now, we will see how to add a folder to a workspace in code?
Open the workspace in vs code and then File -> Add folder to workspace…
Then you can select the folder which you want to add, and then your workspace will looks like below having both the folders.
This is how we can add folder to a workspace in visual studio code.
How to Open and Close a workspace in VS Code
Now we will see how to open and close a workspace in vs code.
You can directly open a workspace by double clicking on the code-workspace file like below:
Or you can open vs code, go to File -> Open Workspace…
Then select the workspace file from the folder above and click on Open.
Similarly, to close a workspace from visual studio code, go to File -> Close workspace like below:
You may like following vs code tutorials:
- How to change background color in visual studio code
- Create a console application in visual studio code
- Facebook Started using Visual Studio Code Officially
- Connect-PnPOnline : The term ‘Connect-PnPOnline’ is not recognized as the name of a cmdlet, function, script file, or operable program
- tabulator js example
In this tutorial we learned:
- What is visual studio code workspace
- How to create a workspace in visual studio code
- How to add a folder to a workspace in visual studio code
- How to Open and Close a workspace in VS Code
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SPGuides.com