Using the dotnet CLI

Step 1: Create a new console application

  1. Open a terminal and navigate to your desired project directory
  2. Create a new console application:
    dotnet new console -n MyFirstConsoleApp
    
  3. Navigate into the new project directory:
    cd MyFirstConsoleApp
    

Step 2: Explore the project structure

  1. Open the folder in Visual Studio Code.
  2. Install the C# Dev Kit extension if not already installed
  3. Examine the generated files, particularly Program.cs and MyFirstConsoleApp.csproj.

Step 3: Build and run the console application

  1. Build the application:
    dotnet build
    
  2. Run the application:
    dotnet run