This is one way to determine what version of .NET Core is installed on your machine (or if it’s not installed):
- Launch Windows PowerShell.
(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name
(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name
In the following example, you can see that .NET Core 2.1.2 Runtime is installed, but the SDK is not installed with the following error message:
dir : Cannot find path 'C:\Program Files\dotnet\sdk' because it does not exist. At line:1 char:2 + (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\Program Files\dotnet\sdk:String) [Get-ChildItem], ItemNotFoundExcept ion + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand PS C:\Windows\system32>
Otherwise, it will look more like the next screenshot:
There’s another way to accomplish the same thing with a much simpler command and this works on either Windows or macOS.
- Depending on your operating system, launch either Windows PowerShell or Terminal.
When you see more than one entries, that means you have several versions installed and actually that’s the advantage of using .NET Core, you can have different versions installed side-by-side. The latest version is the last version number at the bottom of the result.
If you need a way to check the installed version of .NET Framework instead, check the link here.
How to determine if .NET Core is installed
How to: Determine which .NET Framework versions are installed
How to: Determine which .NET Framework security updates and hotfixes are installed
How to Use System.Configuration.ConfigurationManager on .NET CORE