This is the way to determine what version of .NET Core is installed on your machine (or if it’s not installed):
- Launch Windows PowerShell.
- Runtime
(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name
- SDK
(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:
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. In this case, the version of the .NET Core Runtime is 2.1.7 while the version of the SDK is 2.1.503.
If you need a way to check the installed version of .NET Framework instead, check the link here.
Further Reading
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
Leave a Reply