Menu Close
Settings Close

Language and Page Formatting Options

Chapter 3. Creating an application using .NET 6.0

Learn how to create a C# hello-world application.

Procedure

  1. Create a new Console application in a directory called my-app:

    $ dotnet new console --output my-app

    The output returns:

    The template "Console Application" was created successfully.
    
    Processing post-creation actions...
    Running 'dotnet restore' on my-app/my-app.csproj...
      Determining projects to restore...
      Restored /home/username/my-app/my-app.csproj (in 67 ms).
    Restore succeeded.

    A simple Hello World console application is created from a template. The application is stored in the specified my-app directory.

Verification steps

  • Run the project:

    $ dotnet run --project my-app

    The output returns:

    Hello World!