如何检查是否已安装 .NETHow to check that .NET is already installed
11/10/2020
本文内容
本文介绍如何检查计算机上安装的 .NET 运行时和 SDK 的版本。This article teaches you how to check which versions of the .NET runtime and SDK are installed on your computer. 如果你拥有一个集成开发环境(如 Visual Studio 或 Visual Studio for Mac),则可能已安装 .NET。If you have an integrated development environment, such as Visual Studio or Visual Studio for Mac, .NET may have already been installed.
安装 SDK 便会安装相应的运行时。Installing an SDK installs the corresponding runtime.
如果本文中的任何命令失败,则未安装运行时或 SDK。If any command in this article fails, you don't have the runtime or SDK installed. 有关详细信息,请参阅 Windows、macOS 或 Linux 的安装文章。For more information, see the install articles for Windows, macOS, or Linux.
检查 SDK 版本Check SDK versions
可使用终端查看当前安装的 .NET SDK 版本。You can see which versions of the .NET SDK are currently installed with a terminal. 打开终端并运行以下命令。Open a terminal and run the following command.
dotnet --list-sdks
将获得类似于下面的输出。You get output similar to the following.
2.1.500 [C:\program files\dotnet\sdk]
2.1.502 [C:\program files\dotnet\sdk]
2.1.504 [C:\program files\dotnet\sdk]
2.1.600 [C:\program files\dotnet\sdk]
2.1.602 [C:\program files\dotnet\sdk]
3.1.100 [C:\program files\dotnet\sdk]
5.0.100 [C:\program files\dotnet\sdk]
2.1.500 [/home/user/dotnet/sdk]
2.1.502 [/home/user/dotnet/sdk]
2.1.504 [/home/user/do