Get Started with .NET
Welcome to the .NET ecosystem! This guide will help you set up your development environment and build your first .NET application.
What is .NET?
.NET is a free, cross-platform, open-source developer platform for building many different types of applications. With .NET, you can:
- Build web, mobile, desktop, cloud, IoT, and gaming applications.
- Use C#, F#, or Visual Basic for development.
- Deploy to Windows, macOS, Linux, iOS, Android, and more.
Step-by-Step Guide
-
1
Install the .NET SDK
The .NET SDK (Software Development Kit) includes the tools you need to build and run .NET applications, including the compiler, runtime, and libraries.
Visit the official .NET Download page to get the latest version for your operating system.
Follow the installation instructions provided. After installation, open a new terminal or command prompt and verify the installation by running:
dotnet --version
-
2
Create Your First Application
Let's create a simple "Hello, World!" console application. Navigate to your desired project directory in the terminal and run:
dotnet new console -o MyFirstApp cd MyFirstApp
This command creates a new console application project named `MyFirstApp` and then changes the current directory to it.
-
3
Explore the Code
Open the
Program.cs
file in your favorite code editor. You'll see something like this:// Program.cs using System; Console.WriteLine("Hello, World!");
This is the core of your application. The
Console.WriteLine
method prints the specified text to the console. -
4
Run Your Application
To run your application, simply execute the following command in your terminal from the `MyFirstApp` directory:
dotnet run
You should see the output:
Hello, World!
Congratulations! You've just built and run your first .NET application.
Next Steps
Now that you have a basic understanding, you can dive deeper:
- Explore Core Concepts to learn about types, control flow, and object-oriented programming in C#.
- Discover the Base Class Library, which provides a rich set of functionalities.
- Try building different types of applications, such as web apps with ASP.NET Core or desktop apps with WPF.