I want a simple way, like java -version, to find out which versions of .NET are installed on a Windows machine. Visual Studio might not be installed, so I need a reliable method to check .NET version cmd using only the command prompt or PowerShell.
I’ve been working with .NET since the Core days, and honestly, the quickest way I check .net version cmd is by running:
dotnet --info
This gives me the installed SDKs and runtimes, super handy, especially when I don’t have Visual Studio set up. If I’m in a rush and just need the version number:
dotnet --version
That’s the simplest. But keep in mind, this won’t cover the older .NET Framework versions.
Same here, been in .NET projects for a while. To add to what @yanisleidi-rodriguez mentioned, if you’re dealing with legacy systems or older Windows apps, you’ll likely need to check .NET Framework too. Here’s how I check .net version cmd via PowerShell:
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" | Select-Object Release
Then you just match the ‘Release’ number with Microsoft’s official version list. It’s not as clean, but works even if you don’t have dotnet CLI installed.
That’s pretty much my approach too, after a few years troubleshooting across environments, I combined both methods. If you want a one-stop way to check .net version cmd, both Core and Framework, I use this PowerShell combo:
dotnet --info
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse |
Get-ItemProperty -Name Version -EA 0 |
Where { $_.Version -match '^\d' } |
Select Version, PSChildName
This way, I get the full picture, Framework versions tucked away in the registry, and modern .NET versions from the CLI. Saves time when I’m auditing multiple setups