Projects are containers for your source code, icons, images, and data files. Before performing any work in VS Code, you must first create projects to store your work. Doing so will set up the framework for your app or website.
Creating new projects in VS Code is similar for all programming languages. However, being more of a code editor than an IDE, you do not have pre-installed templates for creating projects. Instead, you have to install extensions and run the syntax in the console.
How to Create a new C# project
-
- From the sidebar, select the Extensions tab. Next, search for C# in the search box and click the Install button.
- Download and install .Net Core from dotnet.microsoft.com/download
- From the “Explorer” pane in VS Code, select the Open Folder button.
- Create a folder in your preferred directory to store your programs. For example, I will choose “Practice.”
- From the top-level “View” menu, select Terminal.
- To create a new C# project, run the following command in the Terminal:
dotnet new console
- You will find multiple files inside your folder in the Explorer pane. These files will have a simple template to let you start working on your C# project.
How to create a new Python project
Like we installed an extension for a C# project, we will also need an extension for Python.
- Open the Extension pane from the sidebar or press CTRL + Shift + X.
- Search for Python in the search box and select Install.
- Download and install Python from python.org/downloads. You can follow the Python walkthrough to install Python.
- Open your pre-made python project folder from its directory.
- Press CTRL + Shift + P and enter Python: Select Interpreter in the command palette to choose the Interpreter.
Python project is now established in Visual Studio Code. Now you can create new files inside the folder and run your codes.
How to create a new Java project
- First, we will need to install Java Extensions Pack from the Extensions tab.
- Next, select the Explorer tab from the sidebar and select Create Java Project.
- VS Code will now present a palette to select the project type. Next, choose the No build tools option.
- Choose the preferred directory to store your work. For example, I am choosing a folder named “Practice”.
- Give your project a name, then hit Enter.
- Now, we can find our project on the Explorers pane with all the source files inside it.
How to create a new NodeJS project
- Create a JavaScript file by left-clicking on the New File button. In this example, we will name the file app.js.
- From the top-level “View” menu, choose the Terminal option.
- In the terminal, enter the following command:
npm install express
.Hit Enter.
- Then, enter the following command:
npm install nodemon
.Hit Enter.
- Now, we can find our project structure in the Explorer pane.