如何确定是否安装了 .NET Core [英] How to determine if .NET Core is installed
问题描述
我知道对于旧版本的 .NET,您可以通过以下操作确定是否安装了给定版本
https://support.microsoft.com/en-us/kb/318785
是否有确定是否安装了 .NET Core 的官方方法?
(我不是说 SDK,我想检查没有 SDK 的服务器,以确定它是否安装了 DotNetCore.1.0.0-WindowsHosting.exe)
我能看见
HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NET Cross-Platform Runtime Environment.NET Framework 4.6Winv1-rc1
在我的 Windows 7 机器上版本号为 1.0.11123.0,但我在 Windows 10 机器上看不到相同的内容.
很好的问题,答案并不简单.没有显示所有 .net 核心版本"命令,但有希望.
我不确定它是何时添加的,但 info 命令现在在其输出中包含此信息.它将打印出已安装的运行时和 SDK,以及一些其他信息:
dotnet --info
如果您只想查看 SDK:dotnet --list-sdks
如果您只想查看已安装的运行时:dotnet --list-runtimes
我使用的是 Windows,但我想这也适用于 Mac 或 Linux 以及当前版本.
此外,您可以参考 .NET Core 下载存档 帮助您解密 SDK 版本.
<小时>旧信息:此点以下的所有内容都是旧信息,相关性较低,但可能仍然有用.
查看已安装的运行时:
在 Windows 资源管理器中打开 C:Program FilesdotnetsharedMicrosoft.NETCore.App
查看已安装的SDK:
在 Windows 资源管理器中打开 C:Program Filesdotnetsdk
(位置来源:开发者博客)
<小时>此外,您可以通过在命令提示符处发出以下命令来查看安装的最新运行时和 SDK 版本:
dotnet
最新运行时版本是列出的第一件事. 免责声明:这不再有效,但可能适用于旧版本.>
dotnet --version
最新的 SDK 版本 免责声明:显然这个结果可能会受到任何 global.json 配置文件的影响.
在 macOS 上,您可以使用以下命令检查 .net 核心版本.
ls/usr/local/share/dotnet/shared/Microsoft.NETCore.App/
在 Ubuntu 或 Alpine 上:
ls/usr/share/dotnet/shared/Microsoft.NETCore.App/
它会列出安装版本名称的文件夹.
I know that for older versions of .NET, you can determine if a given version is installed by following
https://support.microsoft.com/en-us/kb/318785
Is there an official method of determining if .NET Core is installed?
(And I don't mean the SDK, I want to check a server without the SDK, to determine if it has DotNetCore.1.0.0-WindowsHosting.exe installed on it)
I can see
HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NET Cross-Platform Runtime Environment.NET Framework 4.6Winv1-rc1
with Version# of 1.0.11123.0 on my windows 7 machine, but I don't see the same stuff on my Windows 10 machine.
Great question, and the answer is not a simple one. There is no "show me all .net core versions" command, but there's hope.
EDIT:
I'm not sure when it was added, but the info command now includes this information in its output. It will print out the installed runtimes and SDKs, as well as some other info:
dotnet --info
If you only want to see the SDKs: dotnet --list-sdks
If you only want to see installed runtimes: dotnet --list-runtimes
I'm on Windows, but I'd guess that would work on Mac or Linux as well with a current version.
Also, you can reference the .NET Core Download Archive to help you decipher the SDK versions.
OLDER INFORMATION: Everything below this point is old information, which is less relevant, but may still be useful.
See installed Runtimes:
Open C:Program FilesdotnetsharedMicrosoft.NETCore.App
in Windows Explorer
See installed SDKs:
Open C:Program Filesdotnetsdk
in Windows Explorer
(Source for the locations: A developer's blog)
In addition, you can see the latest Runtime and SDK versions installed by issuing these commands at the command prompt:
dotnet
Latest Runtime version is the first thing listed. DISCLAIMER: This no longer works, but may work for older versions.
dotnet --version
Latest SDK version DISCLAIMER: Apparently the result of this may be affected by any global.json config files.
On macOS you could check .net core version by using below command.
ls /usr/local/share/dotnet/shared/Microsoft.NETCore.App/
On Ubuntu or Alpine:
ls /usr/share/dotnet/shared/Microsoft.NETCore.App/
It will list down the folder with installed version name.
这篇关于如何确定是否安装了 .NET Core的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!