Note
ამ გვერდზე წვდომა ავტორიზაციას მოითხოვს. შეგიძლიათ სცადოთ შესვლა ან დირექტორიების შეცვლა.
ამ გვერდზე წვდომა ავტორიზაციას მოითხოვს. შეგიძლიათ სცადოთ დირექტორიების შეცვლა.
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:
- A GitHub account to use GitHub Codespaces. If you don't already have one, you can create a free account at GitHub.com.
- A computer with the following tools installed:
- The .NET 10 SDK.
- Visual Studio Code.
- The C# DevKit.
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
When your codespace loads, create a new file in the
tutorialsfolder namedhello-world.cs.Open your new file.
Type or copy the following code into
hello-world.cs:Console.WriteLine("Hello, World!");In the integrated terminal window, make the
tutorialsfolder 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.
Understand the code
The app consists of a single line of C# code:
Console.WriteLine("Hello, World!");
Breaking down each part:
Consoleis a built-in .NET type that provides functionality for working with the console.WriteLineis a method ofConsolethat writes text followed by a new line."Hello, World!"is a string literal, a sequence of characters enclosed in double quotation marks. The text inside the string is what gets displayed in the console.- The semicolon (
;) marks the end of a statement in C#.
How file-based apps work
When you run the following command:
dotnet hello-world.cs
The .NET SDK automatically compiles the .cs file and runs the resulting app in one step. You don't need a project file (.csproj) or any extra setup.
File-based apps are useful for learning, experimenting, and writing small utilities. As your applications grow, you'll typically use project-based apps to organize code, dependencies, and configuration.
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.