Knowing the version of the .NET SDK installed on your machine is essential for ensuring compatibility with your projects and for troubleshooting issues. The .NET Command Line Interface (CLI) provides a simple command to check the installed version of the .NET SDK. This guide will walk you through the steps to view the version of the .NET SDK using the CLI.
How to Check the .NET SDK Version
To view the version of the .NET SDK installed on your machine, you can use the following command:
dotnet --version
This command will display the version number of the .NET SDK currently in use. It is a quick and straightforward way to check the installed version.
Step-by-Step Instructions
Step 1: Open Your Command Line Interface
Open your terminal (macOS/Linux) or command prompt (Windows).
Step 2: Run the Version Command
Type the following command and press Enter
:
dotnet --version
After executing this command, you should see output similar to the following:
5.0.400
In this example, 5.0.400
indicates that version 5.0.400 of the .NET SDK is installed on the machine.
Viewing All Installed SDKs
If you want to see all versions of the .NET SDK installed on your machine, you can use the following command:
dotnet --list-sdks
This command will display a list of all installed SDK versions along with their installation paths. The output will look something like this:
5.0.400 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
In this example, both version 5.0.400 and version 3.1.100 of the .NET SDK are installed on the machine.
Conclusion
Checking the version of the .NET SDK installed on your machine using the CLI is a simple yet important task for any .NET developer. By using the dotnet --version
command, you can quickly determine the current SDK version, while the dotnet --list-sdks
command allows you to view all installed SDK versions. Keeping track of your SDK versions is essential for ensuring compatibility with your projects and for effective development practices.