Pages

Wednesday, June 18, 2014

How to List all .NET Versions installed on your Computer

This post covers a verity of ways to List all the .NET versions on your machine

The Powershell Script and final directory command are quickest. 

Poweshell Script to List all .NET Versions





Poweshell Output


PSChildName                        Version                            Release                           Product                          
-----------                        -------                            -------                           -------                          
v2.0.50727                         2.0.50727.5420                                                                                        
v3.0                               3.0.30729.5420                                                                                        
Windows Communication Foundation   3.0.4506.5420                                                                                         
Windows Presentation Foundation    3.0.6920.5011                                                                                         
v3.5                               3.5.30729.5420                                                                                        
Client                             4.6.01055                          394271                            4.6.1                            
Full                               4.6.01055                          394271                            4.6.1                            
Client                             4.0.0.0                                                                                               


The following wmic command will list all products starting with Microsoft .NET for x64 installs. Run the following from command line (run as Administrator).
Note
: This is very slow and take about 2 mins to run (even on Intel i7!).



wmic product where "Name like 'Microsoft .Net%'" get Name, Version


Produces the bottom half. Results seem to list x64 installs. (It should list upper half as well).



Name                                               Version
Microsoft .NET Framework 4.6.1                     4.6.01055
Microsoft .NET Framework 4.5 Multi-Targeting Pack  4.5.50709
Microsoft .NET Framework 4 Multi-Targeting Pack    4.0.30319
Microsoft .NET Framework 4.5 SDK                   4.5.50709


Update - Jun 2015: This list only .NET Frameworks now greater than  .NET 4.0. See below to get those.

The official recommended way by Microsoft is to check the registry, see below for partial snippet of that page.

Update - Jun 2015: This list only .NET Frameworks less than .NET 4.0. 

To do this, following the steps below:


  1. Click Start, type regedit in the Search programs and files box (click Run and type regedit in the Run Dialogbox in Windows XP), and then press Enter.
  2. In the Registry Editor, locate the Registry Key Name in the table below and check the value for the related .NET Framework.






To find .NET Framework versions by querying the registry in code (.NET Framework 4.5 and later)
  1. The existence of the Release DWORD indicates that the .NET Framework 4.5 or later has been installed on a computer. The value of the keyword indicates the installed version. To check this keyword, use the OpenBaseKey and OpenSubKey methods of theMicrosoft.Win32.RegistryKey class to access the Software\Microsoft\NET Framework Setup\NDP\v4.0\Full subkey under HKEY_LOCAL_MACHINE in the Windows registry.
  2. Check the value of the Release keyword to determine the installed version. To be forward-compatible, you can check for a value greater than or equal to the values listed in the table. Here are the .NET Framework versions and associated Release keywords.
    Check full article here https://msdn.microsoft.com/en-us/library/hh925568%28v=vs.110%29.aspx

The following wmic cmd (run as Administrator) lists any product with .NET in the name and for x32 files and is still very slow.

wmic /namespace:\\root\cimv2 path win32_product where "Name like '%%.NET%%'" get Name, Version



Name                                                          Version

Microsoft Visual Studio 2010 ADO.NET Entity Framework Tools  10.0.40219
Microsoft ASP.NET MVC 2                                      2.0.50217.0
Blend for Visual Studio SDK for .NET 4.5                     3.0.40218.0
Microsoft ASP.NET MVC 4 Runtime                              4.0.20710.0
Microsoft ASP.NET Visual Studio 2010 Finalizer               4.0.20710.0
Microsoft .NET Framework 4.5 Multi-Targeting Pack            4.5.50709
Microsoft ASP.NET Visual Studio 2010 Uninstall Finalizer     4.0.20710.0
Microsoft ASP.NET MVC 2 - Visual Studio 2010 Tools           2.0.50217.0
Microsoft ASP.NET Web Pages 2 Runtime                        2.0.20713.0
Tools for .Net 3.5                                           3.11.50727
Microsoft ASP.NET MVC 3                                      3.0.20105.0
Microsoft ASP.NET MVC 3 - Visual Studio 2010 Tools Update    3.0.20406.0
Microsoft Expression Blend SDK for .NET 4                    2.0.20525.0
Microsoft .NET Framework 4 Multi-Targeting Pack              4.0.30319
Microsoft Sync Services for ADO.NET v2.0 SP1 (x64)           2.0.3010.0
Microsoft .NET Framework 4.5 SDK                             4.5.50709
Microsoft ASP.NET Web Pages 2 - Visual Studio 2010 Tools     2.0.20710.0
Microsoft .NET Framework 4.5.1                               4.5.50938
Microsoft ASP.NET Web Pages - Visual Studio 2010 Tools       1.0.20105.0
Microsoft ASP.NET Web Pages                                  1.0.20105.0
Microsoft ASP.NET MVC 4 - Visual Studio 2010 Tools           4.0.20710.
 
Update - Jun 2015: This list only .NET Frameworks now greater than  .NET 4.0. 

This dir cmd (run as administrator) quickly shows installed frameworks x86 and x64, and list installed .NET frameworks below .NET 4.0. 

This list .NET 1.0 to .NET 4.0.
for x86
dir %WINDIR%\Microsoft.Net\Framework\v* /O:-N /B

for x64
dir %WINDIR%\Microsoft.Net\Framework64\v* /O:-N /B
The elevated command produces the following results for both x86,  x64 (has no 1.x versions)
c:\Users\Mutex>
v4.0.30319
v3.5
v3.0
v2.0.50727
v1.1.4322
v1.0.3705

Note: Microsoft change the way it installs .NET Frameworks
 

The .NET Framework 4.5 replaces the .NET Framework 4. When you install the .NET Framework 4.5 on a system that has the .NET Framework 4 installed, the assemblies are replaced. 

 Both 4.5 and 4.51 are in-place upgrades, which means they replace the previous version (4 or 4.5). The files are overwritten and these framework versions do not have their own directory but are stored in 'v4.0.30319'.

No comments:

Post a Comment