Problem
I know that for previous versions of.NET, you can check if a particular version is installed by using the following command.
https://support.microsoft.com/en-us/kb/318785
Is there a way to tell if.NET Core is installed on a computer?
(I’m not talking about the SDK; I’m looking to see if a server without the SDK has DotNetCore.1.0.0-WindowsHosting.exe installed.)
I can see
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NET Cross-Platform Runtime Environment\.NET Framework 4.6\Win\v1-rc1
I see the same thing on my Windows 7 machine with Version# 1.0.11123.0, but not on my Windows 10 machine.
Asked by weloytty
Solution #1
Great question, and the answer isn’t straightforward. There is no command to “display me all.net core versions,” but there is hope.
EDIT:
I’m not sure when this information was added, but the info command now includes it in its output. It will display the installed runtimes and SDKs, as well as some other information:
dotnet –info
Dotnet —list-sdks if you only want to see the SDKs
Dotnet —list-runtimes if you simply want to see installed runtimes
I’m using Windows, but I’m sure a current version would function on Mac or Linux as well.
You can also use the.NET Core Download Archive to figure out which SDK versions are available.
OLDER INFORMATION: Everything below this point is outdated information that may or may not be useful.
See installed Runtimes:
Open the C:Program Filesdotnetshared folder. In Windows Explorer, look for Microsoft.NETCore.App.
See installed SDKs:
In Windows Explorer, navigate to C:Program Filesdotnetsdk.
(The locations came from a developer’s blog.)
You may also see the most recent Runtime and SDK versions installed by running the following statements at the command prompt:
The first item on the list is the dotnet Latest Runtime version. DISCLAIMER: This link is no longer active, although it may work on older versions.
dotnet —version The most recent version of the SDK DISCLAIMER: Any global.json config files appear to have an impact on the outcome.
You may check the.net core version on macOS by using the command below.
ls /usr/local/share/dotnet/shared/Microsoft.NETCore.App/
When using Ubuntu or Alpine:
ls /usr/share/dotnet/shared/Microsoft.NETCore.App/
It will display a list of folders, each with the name of the installed version.
Answered by Sean
Solution #2
Using Powershell:
Runtimes:
(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name
SDKs:
(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name
Answered by Andriy Tolstoy
Solution #3
PowerShell with the following command is the proper solution for runtime-only environments without the SDK, such as a server with the Windows Hosting package installed:
dotnet --info
According to the official documents:
Another official article explaining how.NET Core versioning works can be found here.
Answered by Chiramisu
Solution #4
You may see if dotnet.exe is available by running the following command:
where dotnet
After that, you may check the version:
dotnet –version
UPDATE: There is now a better way to do it, which is nicely discussed in a number of other answers:
dotnet –info
Answered by Robert Paulsen
Solution #5
One of the easiest ways to see if.NET Core is installed on Windows is to do the following:
There should be no errors in the above steps if.NET Core is installed.
Answered by xameeramir
Post is based on https://stackoverflow.com/questions/38567353/how-to-determine-if-net-core-is-installed