295

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.

Suncatcher
  • 8,420
  • 8
  • 42
  • 78
sepang
  • 4,170
  • 4
  • 21
  • 23
  • 3
    Go to run and execute this command: wmic /namespace:\\root\cimv2 path win32_product where "name like '%%.NET%%'" get version – HENG Vongkol Sep 03 '16 at 13:06
  • See [How to: Determine Which .NET Framework Versions Are Installed](https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed) and [Identifying the .NET version you are running (2.0, 4.5, 4.5.1 or 4.5.2)](https://blogs.msdn.microsoft.com/rodneyviana/2014/12/23/identifying-the-net-version-you-are-running-2-0-4-5-4-5-1-or-4-5-2/) – samis Dec 14 '17 at 19:56
  • Possible duplicate of [How do I detect what .NET Framework versions and service packs are installed?](https://stackoverflow.com/questions/199080/how-do-i-detect-what-net-framework-versions-and-service-packs-are-installed) – Wai Ha Lee Jan 11 '18 at 11:07

19 Answers19

386

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.)

  1. If you want to check the latest .NET 4 version.
  2. 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

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
AnandShanbhag
  • 5,363
  • 1
  • 16
  • 17
  • 6
    found this to be the easiest and most precise one (with the "*\v4\Full" at the end) as it gets the minor version too with just one simple command. – Ignas Vyšnia Dec 13 '16 at 15:55
  • 1
    Nice. Wanted something that would work on a users PC and this is it. Thanks! – Kelly May 12 '17 at 20:35
  • Full details and examples: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed – typpo Jun 14 '17 at 22:14
  • 8
    Nice but doesn't show the 4.5, 4.6 and 4.7 frameworks which are installed on my Windows 7 machine:( – Zeek2 Jul 25 '17 at 10:35
  • not quite accurate; I look under Control Panel> Programs and Features, and there is no sign of .NET.; however, I run your command and it gives me the output HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0 . Probably, .NET has once been installed on my machine, has been unistalled, but the registry did not get cleaned – Newton fan 01 May 17 '18 at 12:01
  • This doesn't list all versions. I have 4.6.1 and all previous versions but all that query does is list up to 4.0 – Neil Walker Jul 19 '18 at 12:44
  • @NeilWalker If you only ran the first query then no, you won't get anything past 4.0. Try the second query, which will return the latest 4.5+ version you have installed. – James Skemp Jul 19 '18 at 16:21
  • What I like about this is that I don't have to go use regedit where there's always a chance of accidentally making a change. Thanks for this. – Doug F Apr 01 '19 at 14:19
263

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.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Binoj Antony
  • 15,352
  • 24
  • 86
  • 95
  • 7
    'CSC' will only work from the Visual Studio command prompt (by default). It wil also only give you the maximum version of the .NET framework that version of the compiler targets. - If you have VS2005 & VS2008 installed the different versions of CSC will report different versions. – Matt Lacey Oct 14 '09 at 10:37
  • ok, then I need to add that visual studio is not installed :-) – sepang Oct 14 '09 at 10:38
  • 19
    `csc` outputs the version of the C# compiler, not the version of the .NET Framework. – Timwi Aug 18 '11 at 15:17
  • +1. As an addition, here is the related article from MSDN: [How to: Determine Which .NET Framework Versions Are Installed](http://msdn.microsoft.com/en-us/library/hh925568.aspx) – informatik01 Sep 03 '13 at 15:59
  • last command is the correct solution: dir /b /ad /o-n %systemroot%\Microsoft.NET\Framework\v?.* – maxweber Nov 06 '14 at 16:09
  • 4
    last command didn't return version 4.5 even though I think I have it installed. The answer at http://stackoverflow.com/questions/3487265/powershell-script-to-return-versions-of-net-framework-on-a-machine included it. – lmsurprenant Jan 06 '15 at 20:24
  • 2
    Last command is not showing the latest version. We can lookup the version in appwiz.cpl or 'wmic product' command is also helpful. http://www.windows-commandline.com/find-net-version-on-your-computer/ – Giri Feb 04 '15 at 06:32
  • 12
    Cheers for Number 8! – Lionet Chen Jun 15 '17 at 13:36
  • Note: Command #4 does not show Microsoft .NET Compact Framework instances. – Zeek2 Jul 25 '17 at 10:25
  • 1
    Just adding a note that on a couple servers I've run these on that #8 with the PowerShell command reading from the registry was the only one that listed out the .Net Framework 4.7. – Chad Rexin Jan 23 '18 at 17:00
  • Here's a way to do the wmic with an sql like filter: `wmic product where "description like '%.NET Framework%'" get description` – js2010 Mar 11 '19 at 19:31
  • The powershell options are the most universal, since they do not rely on Visual Studio or .NET SDK being installed. #8 is my favorite – Daniel Williams Mar 21 '19 at 15:28
  • At least for the Powershell methods, the version numbers return are not the "displayed" version numbers. I get 4.0 for v4.5.2. – Steve Smith May 15 '19 at 13:42
  • Cheers cmd 4 "wmic product get description | findstr /C:".NET Framework"". It worked in regular cmd prompt. – Venkat Aug 26 '19 at 11:07
  • 5. A positional parameter cannot be found that accepts argument '/o-n'. – pabrams Feb 05 '21 at 21:02
  • On Win10 20H2 option 5 returns nothing – Suncatcher May 23 '21 at 09:32
40

.NET Version Detector is a GUI utility that displays which of the six(!) versions of the framework are installed.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Phil Devaney
  • 16,607
  • 6
  • 39
  • 31
38

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

Open My Computer → double click "C:" drive → double click "Windows" → double click "Microsoft.NET" → double click "Framework" → Inside this folder, there will be folder(s) like "v1.0.3705" and/or "v2.0.50727" and/or "v3.5" and/or "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

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
  • 2
    Quite good, but the output is different at least on my server - No "for" message was included: https://lh4.googleusercontent.com/-p7Fu5GDj0cg/UywSqPTdQjI/AAAAAAAAALQ/UAHe7Q2ImUM/w465-h73-no/clip.png – Joel Peltonen Mar 21 '14 at 10:22
  • 2
    **to change directory** type : `cd C:\Windows\Microsoft.NET\Framework\v4.0.30319` and then type `csc.exe` , hope helps someone. – Shaiju T Mar 13 '16 at 07:36
  • 2
    It's mostly Efficient when you logged in by a limited user account. – Rzassar Oct 26 '16 at 10:55
27

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.

Tobias Tengler
  • 4,101
  • 2
  • 16
  • 32
FelixAVeras
  • 423
  • 4
  • 11
9

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).

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
adrianbanks
  • 76,725
  • 21
  • 166
  • 198
  • Environment.Version seems to give you the application version. Say, from LinqPad I want to find .NET version it is running against and it gives me not the .NET version, but LinqPad version – Naomi Jul 29 '13 at 23:26
  • @Naomi: no, it gives the version of the CLR. From the docs: _"Gets a Version object that describes the major, minor, build, and revision numbers of the common language runtime."_. – adrianbanks Jul 30 '13 at 15:48
  • What I am supposed to see in this object? I am seeing 2.0.50727.5472 2 Minor 0 Build 50727 Revision 5472 MajorRevision 0 MinorRevision 5472 which doesn't look like CLR version runtime to me – Naomi Jul 30 '13 at 19:16
  • I loaded the latest version of LinqPad and now I am getting 4.0.30319.18052 for the version. The previous version was targeting .NET 3.5 version. So, I am still a bit confused - does it indeed show CLR version? – Naomi Jul 30 '13 at 19:29
  • 1
    @Naomi: Yes, it does show the CLR version. 2.0.50727.5472 is the version of the .Net 2.0 CLR, which is also used for .Net 3.0 and 3.5. 4.0.30319.18052 is .Net 4.0, which has a different version number. – adrianbanks Jul 30 '13 at 21:51
8

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.

RBT
  • 18,275
  • 13
  • 127
  • 181
7

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
Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Michael Arnell
  • 988
  • 1
  • 8
  • 16
  • 8
    Not recommended because this is possibly misleading. If you upgraded 4.0 => 4.5.2, the directory might only show v4.0.30319. See Sunimal Kaluarachchi's example. – Dinah Jun 18 '15 at 10:53
7

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.

Dov Benyomin Sohacheski
  • 5,155
  • 7
  • 31
  • 54
Steve Junior
  • 128
  • 1
  • 5
5

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.)

Community
  • 1
  • 1
kmote
  • 14,865
  • 10
  • 62
  • 84
  • Versions *1.0* and *1.1* do not show up in *NET Framework Setup* key, though do exists in %systemroot%\Microsoft.NET\Framework\ folder. – samis Dec 14 '17 at 19:33
5

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

halfer
  • 18,701
  • 13
  • 79
  • 158
pixel
  • 6,765
  • 12
  • 60
  • 101
4

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.

Dan Esparza
  • 26,944
  • 28
  • 97
  • 124
  • If that (incomplete) set of version information is good enough for you, more power to you. – Dan Esparza Mar 22 '17 at 13:00
  • @Shiva You indicate that you think that command shows everything, and I respectfully disagree with you. Please look at the link with the guidelines provided by Microsoft. For example: Your query doesn't show I have .NET 4.6.1 installed. Also, it indicates I have 'CDF' installed, which isn't a .NET framework version. – Dan Esparza Mar 22 '17 at 13:10
4

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://docs.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

Raghav
  • 6,381
  • 4
  • 60
  • 85
2

Try .NET Checker by Scott Hanselman.

A.I
  • 1,348
  • 1
  • 14
  • 18
1

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

James Poulose
  • 2,701
  • 1
  • 26
  • 27
  • 3
    This tool requires not only the .NET framework to be installed, but Visual Studio. The OP indicated that Visual Studio might not be installed. – Dan Esparza Oct 17 '16 at 12:52
  • And it does not show all (or even most) versions. For my Win7 PC is shows only V2.0 & 4.0 but some of the other methods above also show versions: 3.0, 3.5, 4.5, 4.5.1, 4.5.2, 4.6.1 and 4.7. – Zeek2 Jul 25 '17 at 10:40
  • 1
    @Zeek **`clrver`** shows installed **.net runtime(s)**, which can be *shared among* **.net version(s)**. See [How to: Determine Which .NET Framework Versions Are Installed](https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed) and [Identifying the .NET version you are running (2.0, 4.5, 4.5.1 or 4.5.2)](https://blogs.msdn.microsoft.com/rodneyviana/2014/12/23/identifying-the-net-version-you-are-running-2-0-4-5-4-5-1-or-4-5-2/) – samis Dec 14 '17 at 19:52
1

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.

skrie
  • 11
  • 1
  • 1
    It's in the registry, as [documented by Microsoft](https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed). `HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full` - the `Release` value will be `460798` for 4.7 on W10 1607. – Richard Deeming Oct 03 '17 at 10:03
  • It is not. The "Full" key does not even exist. – skrie Oct 03 '17 at 14:08
  • 1
    It is, and it does. I'm running 1607, and I'm looking at the `Full` key right now! – Richard Deeming Oct 03 '17 at 18:34
1

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

Sy C Dang
  • 53
  • 3
  • Probably not the cleanest way, but indeed an option I totally forgot about. A simple `GACUTIL /l ?` in your (developer) powershell yields just the same. – B--rian Jan 13 '20 at 10:50
0

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://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a

lightwing
  • 134
  • 13
-1

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;

Open the command prompt (i.e Windows + R → type “cmd”) and type the following command, all on one line: %windir%\Microsoft.NET\FrameWork, and then navigating to the directory with the latest version number.

Refer to http://dotnettec.com/check-dot-net-framework-version/

Julia
  • 1
  • 1
  • I'm getting this error while trying to follow your answer: `'C:\Windows\Microsoft.NET\FrameWork' is not recognized as an internal or external command, operable program or batch file.` – pavjel Apr 17 '19 at 12:35