How do I find out which version of .NET is installed?
I'm looking for something as simple as java -version
that I can type at the command prompt and that tells me the current version(s) installed.
I better add that Visual Studio may not be installed - this is typically something that I want to know about a client machine.
Just type any one of the below commands to give you the latest version in the first line.
1. CSC
2. GACUTIL /l ?
3. CLRVER
You can only run these from the Visual Studio Command prompt if you have Visual Studio installed, or else if you have the .NET framework SDK, then the SDK Command prompt.
4. wmic product get description | findstr /C:".NET Framework"
5. dir /b /ad /o-n %systemroot%\Microsoft.NET\Framework\v?.*
The last command (5) will list out all the versions (except 4.5) of .NET installed, latest first.
You need to run the 4th command to see if .NET 4.5 is installed.
Another three options from the PowerShell command prompt is given below.
6. [environment]::Version
7. $PSVersionTable.CLRVersion
8. gci 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | gp -name Version,Release -EA 0 |
where { $_.PSChildName -match '^(?!S)\p{L}'} | select PSChildName, Version, Release
The last command (8) will give you all versions, including .NET 4.5.
If you are looking to get the versions of .NET >= 5 and .NET Core then the following commands can be used
9. dotnet --list-sdks
10. dotnet --list-runtimes
11. dotnet --info
As evident from the commands above, 9 will list all the SDKs and 10 will list all the runtimes. 11. will provide the output of both 9 and 10 as well as a whole lot of information pertaining to .NET installation the machine