How To Create A New Project In Visual Studio Code

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 C# Project in Visual Studio Code?

    1. From the sidebar, select the Extensions tab. Next, search for C# in the search box and click the Install button.

      C# Extension
      Install C# extension from the VS Code extensions marketplace.
    2. Download and install .Net Core from dotnet.microsoft.com/download

      Download .Net Core
      Download Dotnet Core from dotnet.microsoft.com/download. Install it with default configurations.
    3. From the “Explorer” pane in VS Code, select the Open Folder button.

      Open Folder
      From the Explorers tab on the sidebar, select Open Folder.
    4. Create a folder in your preferred directory to store your programs. For example, I will choose “Practice.”

      Choose folder
      Open the folder from the preferred directory.
    5. From the top-level “View” menu, select Terminal.

      Open Terminal
      Select View menu and then choose Terminal.
    6. To create a new C# project, run the following command in the Terminal:
      dotnet new console
      dotnet console
      In the console, enter this command and hit Enter: dotnet new console.
    7. 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.

      C# New Project
      You will find the C# project with templates on the Explorer pane.

How To Create A Python Project in Visual Studio Code?

Like we installed an extension for a C# project, we will also need an extension for Python.

  1. Open the Extension pane from the sidebar or press CTRL + Shift + X.

    Extensions Pane Python
    Search for Python in the extensions pane.
  2. Search for Python in the search box and select Install.

    Python Extension
    Install Python Extension.
  3. Download and install Python from python.org/downloads. You can follow the Python walkthrough to install Python.

    Download Python
    Download and install Python with default configurations.
  4. Open your pre-made python project folder from its directory.
    Open Folder
    From the Explorers tab on the sidebar, select Open Folder.
  5. Press CTRL + Shift + P and enter Python: Select Interpreter in the command palette to choose the Interpreter.

    Configure Python Interpreter
    Enter “Python: Select Interpreter” in the command palette to configure the Python 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 Java Project in Visual Studio Code?

  1. First, we will need to install Java Extensions Pack from the Extensions tab.

    Java Extensions Pack
    Install Java Extensions Pack from the extension marketplace.
  2. Next, select the Explorer tab from the sidebar and select Create Java Project.

    Create Java Project
    Select the Create Java Project button from the Explorers tab.
  3. VS Code will now present a palette to select the project type. Next, choose the No build tools option.

    Project Type
    Select the No build tools option as the project type.
  4. Choose the preferred directory to store your work. For example, I am choosing a folder named “Practice”.

    Choose Directory
    Choose a preferred directory to store your files.
  5. Give your project a name, then hit Enter.

    Project Name
    Enter a project name.
  6. Now, we can find our project on the Explorers pane with all the source files inside it.

    Project Files
    A Project structure will appear on the Explorers tab.

How To Create A NodeJS Project in Visual Studio Code?

  1. Create a JavaScript file by left-clicking on the New File button. In this example, we will name the file app.js.

    JavaScript File
    Create a JavaScript file by clicking on the New File icon.
  2. From the top-level “View” menu, choose the Terminal option.

    Terminal
    Choose the Terminal option from the View menu.
  3. In the terminal, enter the following command:
    npm install express.

    Hit Enter.

    NPM Install Express
    Type and execute the following command in the terminal: npm install express.
  4. Then, enter the following command:
    npm install nodemon.

    Hit Enter.

    NPM Install Nodemon
    Type and execute the following command in the terminal: npm install nodemon.
  5. Now, we can find our project structure in the Explorer pane.

    Project
    You will find the Project structure on the Explorer pane.

Was this article helpful?

Leave a Comment