Editja

Ixxerja permezz ta’


Get started with .NET

This tutorial teaches you how to create and run your first .NET app using file-based apps. You write a simple app and see the results of running your code.

In this tutorial, you:

  • Launch a GitHub Codespace with a .NET development environment.
  • Create your first .NET app.
  • Run your app.

Prerequisites

You must have one of the following options:

Open Codespaces

To start a GitHub Codespace with the tutorial environment, open a browser window to the tutorial codespace repository. Select the green Code button, and the Codespaces tab. Then select the + sign to create a new Codespace using this environment.

Create and run your first app

  1. When your codespace loads, create a new file in the tutorials folder named hello-world.cs.

  2. Open your new file.

  3. Type or copy the following code into hello-world.cs:

    Console.WriteLine("Hello, World!");
    
  4. In the integrated terminal window, make the tutorials folder the current folder, and run your app:

    cd tutorials
    dotnet hello-world.cs
    

You ran your first .NET app. It's a simple app that prints the message "Hello, World!" It uses the Console.WriteLine method to print that message. Console is a type that represents the console window. WriteLine is a method of the Console type that prints a line of text to that text console.

Congratulations! You created a simple .NET application.

Cleanup resources

GitHub automatically deletes your Codespace after 30 days of inactivity. If you plan to continue with .NET tutorials, you can leave your Codespace provisioned. If you're ready to download the .NET SDK to your computer, you can delete your Codespace. To delete your Codespace, open a browser window and navigate to your Codespaces. You should see a list of your codespaces in the window. Select the three dots (...) in the entry for the tutorial codespace and select delete.

Next steps

Get started developing .NET applications by following a step-by-step tutorial or by watching .NET 101 videos on YouTube.