Get Started with Your First .NET App

Welcome to the exciting world of .NET development! In this guide, you'll learn how to create and run your very first .NET application. We'll walk you through the essential steps, from setting up your environment to writing and executing your code.

Prerequisites

Before you begin, ensure you have the following installed:

Tip: If you're unsure about installation, refer to the Installation guide for detailed instructions.

Step 1: Create a New Project

Open your terminal or command prompt and navigate to the directory where you want to create your project. Then, run the following command to create a new console application:

dotnet new console -o MyFirstApp

This command does the following:

Navigate into the newly created project directory:

cd MyFirstApp

Step 2: Explore the Project Files

Inside the MyFirstApp directory, you'll find a few essential files:

Step 3: Write Your Code

Open the Program.cs file in your code editor. You'll see something like this:

Console.WriteLine("Hello, World!");

Let's modify it to print a more personalized message. Replace the existing line with the following:

Console.WriteLine("Welcome to your first .NET app!");
Console.WriteLine("Let's build something amazing together!");

Step 4: Run Your Application

Now, it's time to run your application. Make sure you are still in the MyFirstApp directory in your terminal. Execute the following command:

dotnet run

You should see the following output in your terminal:

Welcome to your first .NET app!
Let's build something amazing together!
Did you know? The dotnet run command compiles your project if necessary and then executes the output.

Next Steps

Congratulations! You've successfully created, coded, and run your first .NET application. This is just the beginning of your .NET journey. Here are some ideas for what to explore next:

Continue to Installation Guide