Installing C# and the .NET SDK
This guide will walk you through the steps to install the necessary tools for C# development on your system.
Prerequisites
Before you begin, ensure you have the following:
- A compatible operating system (Windows, macOS, or Linux).
- Administrator privileges on your machine.
- An internet connection.
Download the .NET SDK
The .NET SDK includes the C# compiler, the .NET runtime, and various development tools. You can download the latest version from the official Microsoft website.
Installation Steps
Download the Installer: Navigate to the .NET download page and select the installer appropriate for your operating system. For Windows, this is typically an executable (.exe) file. For macOS and Linux, you'll find package managers or script options.
Run the Installer:
- Windows: Double-click the downloaded .exe file. Follow the on-screen prompts, accepting the license terms and choosing installation options.
- macOS: Open the downloaded .pkg file and follow the installer prompts. You might need to authenticate with your administrator password.
- Linux: Refer to the official documentation for installation via package managers (e.g.,
apt,dnf,yum) or by using the provided script.
Verify Installation: After the installation is complete, open a new terminal or command prompt window and run the following command to check the installed .NET SDK version:
dotnet --version
You should see the version number printed in the console.
Optional: Install a Code Editor/IDE: While you can use any text editor, an Integrated Development Environment (IDE) or a powerful code editor will greatly enhance your productivity.
- Visual Studio: The full-featured IDE for Windows and macOS, offering extensive C# development capabilities. Download Visual Studio
- Visual Studio Code: A lightweight, free, and extensible code editor with excellent C# support via extensions. Download VS Code
Troubleshooting Common Issues
- Command not found: Ensure that the .NET SDK's `bin` directory is added to your system's PATH environment variable. You may need to restart your terminal or command prompt.
- Installation errors: Check the installer logs for specific error messages. Ensure you have enough disk space and that no other programs are interfering with the installation.
Next Steps
Once the .NET SDK is installed, you're ready to start writing your first C# application! We recommend proceeding to the C# Fundamentals section.