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_MACHINE\SOFTWARE\Microsoft\.NET Cross-Platform Runtime Environment\.NET Framework 4.6\Win\v1-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.
(1) If you are on the Window system.
Open the command prompt.
(2) Run the below command If you are on Linux system.
The following commands are available with .NET Core SDK 2.1 (v2.1.300):
To list all installed .NET Core SDKs use:
dotnet --list-sdks
To list all installed .NET Core runtimes use
dotnet --list-runtimes
(tested on Windows as of writing, 03 Jun 2018, and again on 23 Aug 2018)
Update as of 24 Oct 2018: Better option is probably now
dotnet --info
in a terminal or PowerShell window as already mentioned in other answers.One of the dummies ways to determine if
.NET Core
is installed on Windows is:cmd
dotnet --version
If the
.NET Core
is installed, we should not get any error in the above steps.The correct answer for runtime-only environments without the SDK, such as a server with the Windows Hosting package installed, is to run PowerShell with the following command:
Per the official documentation:
--version
option "Prints out the version of the .NET Core SDK in use." and therefore doesn't work if the SDK is not installed. Whereas...--info
option "Prints out detailed information about the CLI tooling and the environment, such as the current operating system, commit SHA for the version, and other information."Here's another official article explaining how .NET Core versioning works. :)
Look in
C:\Program Files\dotnet\shared\Microsoft.NETCore.App
to see which versions of the runtime have directories there. Source.A lot of the answers here confuse the SDK with the Runtime, which are different.
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 Files\dotnet\shared\Microsoft.NETCore.App
in Windows ExplorerSee installed SDK's:
Open
C:\Program Files\dotnet\sdk
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.
On Ubuntu or Alpine:
It will list down the folder with installed version name.