sepang
sepang

Reputation: 5300

How do I find the installed .NET versions?

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.

Upvotes: 399

Views: 852616

Answers (25)

Phil Devaney
Phil Devaney

Reputation: 18017

.NET Version Detector is a GUI utility that displays which versions are installed as well as other relevant information such as KB updates.

.NET Version Detector is a native application, which means it isn't dependent on any version of .NET or .NET Core to run.

Sample output: enter image description here

The "Extra Details" section includes:

<32Bit>
2.0.50727.9179
  ->C:\Windows\Microsoft.NET\Framework\v2.0.50727
4.8.9290.0
  ->C:\Windows\Microsoft.NET\Framework\v4.0.30319

<64Bit>
2.0.50727.9179
  ->C:\Windows\Microsoft.NET\Framework64\v2.0.50727
4.8.9290.0
  ->C:\Windows\Microsoft.NET\Framework64\v4.0.30319

==== Installed .NET Frameworks ====
.NET FW 2.0 SP 2 (CLR 2.0)
.NET FW 3.0 SP 2 (CLR 2.0)
.NET FW 3.5 SP 1 (CLR 2.0)
.NET FW 4.6.2 Windows 11 22H2(CLR 4.0)
.NET FW 4.7 Windows 11 22H2(CLR 4.0)
.NET FW 4.7.1 Windows 11 22H2(CLR 4.0)
.NET FW 4.7.2 Windows 11 22H2(CLR 4.0)
.NET FW 4.8 Windows 11 22H2(CLR 4.0)
.NET FW 4.8.1 Windows 11 22H2(CLR 4.0)

==== Languages ====
< Installed Languages 3.0>
English - United States
< Installed Languages 3.5.x>
English - United States
< Installed Languages 4.x>
English - United States

==== Updates ====
Microsoft .NET Framework 4 Client Profile 
 KB2468871
 KB2468871v2
 KB2478063
 KB2533523
 KB2544514
 KB2600211
 KB2600217
Microsoft .NET Framework 4 Extended 
 KB2468871
 KB2468871v2
 KB2478063
 KB2533523
 KB2544514
 KB2600211
 KB2600217
 KB2468871
 KB2468871v2
 KB2478063
 KB2533523
 KB2544514
 KB2600211
 KB2600217

Upvotes: 45

FarrellRifky07
FarrellRifky07

Reputation: 11

For you guys using WinGet, winget search microsoft.dotnet is the option.

Upvotes: 1

Simon Elms
Simon Elms

Reputation: 19788

There are two different flavours of .NET you may have installed on your machine and the methods of getting the versions of each are very different.

For .NET Framework (the original Windows-only .NET):

Open a PowerShell prompt running as administrator then run the following command:

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse |
  Get-ItemProperty -Name version -EA 0 |
  Where { $_.PSChildName -Match '^(?!S)\p{L}'} |
  Select PSChildName, version  

The results will be similar to:

PSChildName                      Version
-----------                      -------
v2.0.50727                       2.0.50727.4927
v3.0                             3.0.30729.4926
Windows Communication Foundation 3.0.4506.4926
Windows Presentation Foundation  3.0.6920.4902
v3.5                             3.5.30729.4926
Client                           4.8.09032
Full                             4.8.09032
Client                           4.0.0.0

For .NET Core/.NET (the modern cross-platform .NET):

There are two options:

If you do have a .NET SDK installed, at a command prompt run: dotnet --version

The result will be similar to: 8.0.304

If you don't have a .NET SDK installed, at a command prompt run: dotnet --info

The result will be similar to:

.NET SDK:
 Version:           8.0.304
 Commit:            352dc5a01f
 Workload version:  8.0.300-manifests.113cb230
 MSBuild version:   17.10.4+10fbfbf2e
 
Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.304\
 
.NET workloads installed:
 [aspire]
   Installation Source: VS 17.10.35201.131
   Manifest Version:    8.1.0/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.1.0\WorkloadManifest.json
   Install Type:              Msi
   
Host:
  Version:      8.0.8
  Architecture: x64
  Commit:       08338fcaa5
  
.NET SDKs installed:
  3.1.426 [C:\Program Files\dotnet\sdk]
  6.0.321 [C:\Program Files\dotnet\sdk]
  7.0.317 [C:\Program Files\dotnet\sdk]
  8.0.108 [C:\Program Files\dotnet\sdk]
  8.0.304 [C:\Program Files\dotnet\sdk]
  
.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  
Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
    
Environment variables:
  Not set
  
global.json file:
  Not found
  
Learn more:
  https://aka.ms/dotnet/info
  
Download .NET:
  https://aka.ms/dotnet/download

Upvotes: 6

Binoj Antony
Binoj Antony

Reputation: 16204

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

Upvotes: 280

FelixAVeras
FelixAVeras

Reputation: 1384

This answer is applicable to .NET Core only!

Typing dotnet --version in your terminal of choice will print out the version of the .NET Core SDK in use.

Learn more about the dotnet command here.

Upvotes: 106

Stefan Gabor
Stefan Gabor

Reputation: 467

Just simply type: dotnet --list-sdks / dotnet --list-runtimes

Upvotes: 5

YongaJ
YongaJ

Reputation: 205

Run the following command on CMD:

  • dotnet --list-sdks

enter image description here

It will display all installed versions of .net, as seen in image above. You can also run the following command below to see the .net version that is in use:

  • dotnet --version

Upvotes: 1

AnandShanbhag
AnandShanbhag

Reputation: 7110

There is an easier way to get the exact version .NET version installed on your machine from a cmd prompt. Just follow the following instructions;

  1. Open the command prompt (i.e Windows + R → type "cmd").

  2. Type the following command, all on one line:

    reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP"
    

    (This will list all the .NET versions.)

  3. If you want to check the latest .NET 4 version.

  4. Type following instruction, on a single line:

    reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full" /v version
    

Please find the attached image below to see how it is shown.

Enter image description here

Upvotes: 493

ahmad raza
ahmad raza

Reputation: 141

It is exactly like java. Open up the terminal and execute following command

dotnet --version

Following is the screenshot of command executed

Upvotes: 8

Sonny K
Sonny K

Reputation: 704

Before going to a command prompt, please follow these steps...

Go to "C:/Windows/Microsoft.NET/Framework" → Inside this folder, there will be folder(s) like (all or any):

  • v1.0.3705
  • v2.0.50727
  • v3.5
  • v4.0.30319

Your latest .NET version would be in the highest v number folder, so if "v4.0.30319" is available that would hold your latest .NET framework. However, the "v4.0.30319" does not mean that you have the .NET framework version 4.0. The "v4.0.30319" is your Visual C# compiler version, therefore, in order to find the .NET framework version do the following.

Go to a command prompt and follow this path:

C:\Windows\Microsoft.NET\Framework\v4.0.30319 (or whatever the highest v number folder)

C:\Windows\Microsoft.NET\Framework\v4.0.30319 > csc.exe

Output:

Microsoft (R) Visual C# Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 Copyright (C) Microsoft Corporation. All rights reserved.

Example below:

Enter image description here

Upvotes: 53

Paramjot Singh
Paramjot Singh

Reputation: 705

If you have installed visual studio on your machine,

Just go to Help > About Microsoft Visual Studio

You will see info about .NET version that IDE is using.

enter image description here

Upvotes: 0

Trakehner1
Trakehner1

Reputation: 181

open cmd prompt type:

dotnet --info

Upvotes: 18

Raghav
Raghav

Reputation: 9628

Here is the Power Shell script which I used by taking the reference of:

https://stackoverflow.com/a/3495491/148657

$Lookup = @{
    378389 = [version]'4.5'
    378675 = [version]'4.5.1'
    378758 = [version]'4.5.1'
    379893 = [version]'4.5.2'
    393295 = [version]'4.6'
    393297 = [version]'4.6'
    394254 = [version]'4.6.1'
    394271 = [version]'4.6.1'
    394802 = [version]'4.6.2'
    394806 = [version]'4.6.2'
    460798 = [version]'4.7'
    460805 = [version]'4.7'
    461308 = [version]'4.7.1'
    461310 = [version]'4.7.1'
    461808 = [version]'4.7.2'
    461814 = [version]'4.7.2'
    528040 = [version]'4.8'
    528049 = [version]'4.8'
}

# For One True framework (latest .NET 4x), change the Where-Oject match 
# to PSChildName -eq "Full":
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse |
  Get-ItemProperty -name Version, Release -EA 0 |
  Where-Object { $_.PSChildName -match '^(?!S)\p{L}'} |
  Select-Object @{name = ".NET Framework"; expression = {$_.PSChildName}}, 
@{name = "Product"; expression = {$Lookup[$_.Release]}}, 
Version, Release

The above script makes use of the registry and gives us the Windows update number along with .Net Framework installed on a machine.

Reference: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#to-find-net-framework-versions-by-querying-the-registry-in-code-net-framework-45-and-later

Here are the results for the same when running that script on two different machines

  1. Where .NET 4.7.2 was already installed:

enter image description here

  1. Where .NET 4.7.2 was not installed:

enter image description here

Upvotes: 6

pixel
pixel

Reputation: 10587

My god, so much mess to find version of installed .net framework?

Windows > Search > Visual Studio Installer > for installed version of VS, tap on More > Modify > Individual Components and see it there:

enter image description here

Upvotes: 8

RBT
RBT

Reputation: 25955

MSDN details it here very nicely on how to check it from registry:

To find .NET Framework versions by viewing the registry (.NET Framework 1-4)

  1. On the Start menu, choose Run.
  2. In the Open box, enter regedit.exe.You must have administrative credentials to run regedit.exe.
  3. In the Registry Editor, open the following subkey:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP

The installed versions are listed under the NDP subkey. The version number is stored in the Version entry. For the .NET Framework 4 the Version entry is under the Client or Full subkey (under NDP), or under both subkeys.

To find .NET Framework versions by viewing the registry (.NET Framework 4.5 and later)

  1. On the Start menu, choose Run.
  2. In the Open box, enter regedit.exe. You must have administrative credentials to run regedit.exe.
  3. In the Registry Editor, open the following subkey:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full

Note that the path to the Full subkey includes the subkey Net Framework rather than .NET Framework

Check for a DWORD value named Release. The existence of the Release DWORD indicates that the .NET Framework 4.5 or newer has been installed on that computer.

enter image description here

Note: The last row in the above snapshot which got clipped reads On all other OS versions: 461310. I tried my level best to avoid the information getting clipped while taking the screenshot but the table was way too big.

Upvotes: 10

Sy C Dang
Sy C Dang

Reputation: 53

If you'r developing some .Net app (for ex. web app), you can make 1 line of error code (like invoke wrong function name) and reload your page, the .Net version will be showenter image description here

Upvotes: 1

lightwing
lightwing

Reputation: 162

Per Microsoft in powershell:

Get-ChildItem "hklm:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | % { $_ -ge 394802 }

See the table at this link to get the DWORD value to search for specific versions:

https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a

Upvotes: 0

skrie
skrie

Reputation: 9

For anyone running Windows 10 1607 and looking for .net 4.7. Disregard all of the above.

It's not in the Registry, C:\Windows\Microsoft.NET folder or the Installed Programs list or the WMIC display of that same list.

Look for "installed updates" KB3186568.

Upvotes: 0

Steve Junior
Steve Junior

Reputation: 165

Just type the following in the command line:

dir /b /ad /o-n %systemroot%\Microsoft.NET\Framework\v?.*

Your dotnet version will be shown as the highest number.

Upvotes: 8

kmote
kmote

Reputation: 16775

If you do this fairly frequently (as I tend to do) you can create a shortcut on your desktop as follows:

  1. Right click on the desktop and select NewShortcut.
  2. In the location field, paste this string: powershell.exe -noexit -command "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" (this is from Binoj Antony's post).
  3. Hit Next. Give the shortcut a name and Finish.

(NOTE: I am not sure if this works for 4.5, but I can confirm that it does work for 4.6, and versions prior to 4.5.)

Upvotes: 7

Michael Arnell
Michael Arnell

Reputation: 1028

If you open a command prompt and type the following two commands, all framework versions that are installed on the current machine will be listed (each one is stored in a separate directory within this directory).

cd %systemroot%\Microsoft.NET\Framework

dir /A:D

Upvotes: 7

adrianbanks
adrianbanks

Reputation: 83004

For the version of the framework that is installed, it varies depending on which service packs and hotfixes you have installed. Take a look at this MSDN page for more details. It suggests looking in %systemroot%\Microsoft.NET\Framework to get the version.

Environment.Version will programmatically give you the version of the CLR.

Note that this is the version of the CLR, and not necessarily the same as the latest version of the framework you have installed (.NET 3.0 and 3.5 both use v2 of the CLR).

Upvotes: 11

Dan Esparza
Dan Esparza

Reputation: 28385

To just get the installed version(s) at the command line, I recommend using net-version.

  • It's just a single binary.
  • It uses the guidelines provided my Microsoft to get version information.
  • It doesn't require the SDK to be installed.
  • Or the Visual Studio command prompt.
  • It doesn't require you to use regedit and hunt down registry keys yourself. You can even pipe the output in a command line tool if you need to.

Source code is available on github.com

Full disclosure: I created this tool myself out of frustration.

Upvotes: 6

A.I
A.I

Reputation: 1448

Try .NET Checker by Scott Hanselman.

Upvotes: 4

James Poulose
James Poulose

Reputation: 3833

clrver is an excellent one. Just execute it in the .NET prompt and it will list all available framework versions.

Upvotes: 2

Related Questions