Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to determine the .NET Framework version from the command line?

To troubleshoot an installation, sometimes I just want a quick answer to what version of .NET is installed.

Is there a way to determine the .NET Framework version on a standard Windows system, other than looking at the directories?

NOTE: This is not for a development machine, just out-of-the-box windows

The following works, but I'm looking for a simpler way.

dir %WINDIR%\Microsoft.Net\Framework\v*

Directory of C:\Windows\Microsoft.Net\Framework  07/13/2009  07:20 PM    <DIR>          v1.0.3705 07/13/2009  07:20 PM    <DIR>          v1.1.4322 01/20/2010  01:16 PM    <DIR>          v2.0.50727 07/13/2009  09:37 PM    <DIR>          v3.0 01/20/2010  01:02 PM    <DIR>          v3.5 02/10/2010  03:20 AM    <DIR>          v4.0.21006 

UPDATE: Not a solution, but another cool directory formatted listing

dir %WINDIR%\Microsoft.Net\Framework\v* /O:-N /B

v4.0.21006 v3.5 v3.0 v2.0.50727 v1.1.4322 v1.0.3705 
like image 489
Noah Avatar asked Feb 10 '10 16:02

Noah


People also ask

How can I tell what version of .NET My application is using?

Select Programs and Features (or Programs) In the list of installed applications, locate "Microsoft . NET Framework" and verify the version in the Version column to the right.


2 Answers

reg query "HKLM\Software\Microsoft\NET Framework Setup\NDP" /s /v version | findstr /i version | sort /+26 /r 

The top entry is the latest version of the framework installed.

Note: This doesn't work with v1.x of the framework.

Update: I missed the comment that you are looking for something to tell your dad over the phone. If that's the case, the command above is probably not the best approach for you. You might be better off just telling your dad to open Windows Explorer and navigate him to the .NET Framework dir and telling you the numbers in there.

like image 184
Franci Penov Avatar answered Sep 27 '22 23:09

Franci Penov


Based on your update which indicates this is for walking a non-tech savvy end user through it, I suggest going to Scott Hanselman's site http://www.smallestdotnet.com (use Internet Explorer) which uses the user agent string to tell you which .NET Framework you've got and gives you recommendations for getting up to the latest version in the most efficient manner.

Old Answer
With PowerShell you could do this (although the presence of PowerShell already implies at least .NET 2.0)

Get-ChildItem "$($Env:WinDir)\Microsoft.Net\Framework" -i mscorlib.dll -r |     ForEach-Object { $_.VersionInfo.ProductVersion } 

I don't know if there's a comparable way to get the version information in plain old crusty cmd.exe.

like image 21
Josh Avatar answered Sep 27 '22 23:09

Josh