Freigeben über


Identifying the .NET version you are running (2.0, 4.5, 4.5.1 or 4.5.2)

 

.NET 2.0 to 3.5

These version shares the same runtime and the version starts with 2.0.50727 followed by the build number. The file that will tell us the version being used is mscorwks.dll. You may choose other files as well, but this one will be present both in the file system if you want to check it in general as in a dump file. To check in the file system which version of .NET you are using, navigate to the .NET install folder (normally C:\Windows\Microsoft.NET\Framework\v2.0.50727), locate file mscorwks.dll, right click and choose Properties… in the context menu. The full version will be in the details tab:

image

The version is 2.0.50727.8645. What is important here is the build number (8645) which will tell how recent it is compared to RTM (Release to Manufactory) version. It also will tell if you need a particular update. For example, KB 2898868 includes hotfix to resolve some security issues. The notes in file information tells us that mscorwks.dll was updated to 2.0.50727.8000. As 8645 is more recent than 8000 this security update is already incorporated in the built. Just be careful here because sometimes the update applies to other components and you should verify the file affected against yours. If you try to install an update already installed you will be alerted, so feel free to apply the patch “just in case”.

If you have a dump file or is performing a live debug with WinDbg, you can check the version with command lmv m mscorwks as below:

0:000> lmv m mscorwks start end module name 00000642`7f330000 00000642`7fcdc000 mscorwks (deferred) Image path: C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll Image name: mscorwks.dll Timestamp: Wed May 12 00:13:32 2010 (4BEA38FC) CheckSum: 0099D95F ImageSize: 009AC000 File version: 2.0.50727.4455 Product version: 2.0.50727.4455 File flags: 0 (Mask 3F) File OS: 4 Unknown Win32 File type: 2.0 Dll File date: 00000000.00000000 Translations: 0409.04b0 CompanyName: Microsoft Corporation ProductName: Microsoft® .NET Framework InternalName: mscorwks.dll OriginalFilename: mscorwks.dll ProductVersion: 2.0.50727.4455 FileVersion: 2.0.50727.4455 (QFE.050727-4400) FileDescription: Microsoft .NET Runtime Common Language Runtime - WorkStation LegalCopyright: © Microsoft Corporation. All rights reserved. Comments: Flavor=Retail

We see that this build (4455) is before that security hotfix and it would be a very good idea to patch this machine where this dump was captured.

.NET 4.0, 4.5, 4.5.1 and 4.5.2

Unlike .NET 3.5 which share the same runtime with .NET 2.0, .NET 4.5 and beyond DOES NOT share the runtime with .NET 4.0. However, when you update your system to use .NET 4.5 and beyond, all your .NET 4.0 application will run as .NET 4.5. There is no way to make 4.5 and 4.0 to coexist as you can do with .NET 2.0 and .NET 4.0. To make things more challenging, .NET 4.5, 4.5.1 and .NET 4.5.2 share the same version number as .NET 4.0 which is 4.0.30319. So, how can you tell which version you are running? You can use the same methods you used for .NET 2.0, except that the file of interest is rather clr.dll normally at C:\Windows\Microsoft.NET\Framework\v4.0.30319. See figure below:

image

 

The build is 18010 which means it is .NET 4.5. Below is a list with the approximate build range for each version:

.NET Version Clr.dll Build 4.0.30319.<Build>)
.NET 4.0 4.0.30319.0 to 4.0.30319.17000
.NET 4.5 4.0.30319.17001 to 4.0.3019.18400
.NET 4.5.1 4.0.30319.18401 to 4.0.30319.34000
.NET 4.5.2 From 4.0.30319.34000

To verify the version from a dump file in windbg, run the command lmv m clr

0:000> lmv m clr
start end module name
000007f8`3b300000 000007f8`3bc5e000 clr (deferred)
Image path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Image name: clr.dll
Timestamp: Sat Aug 25 01:54:04 2012 (5038768C)
CheckSum: 00967D93
ImageSize: 0095E000
File version: 4.0.30319.18010
Product version: 4.0.30319.18010
File flags: 8 (Mask 3F) Private
File OS: 4 Unknown Win32
File type: 2.0 Dll
File date: 00000000.00000000
Translations: 0409.04b0
CompanyName: Microsoft Corporation
ProductName: Microsoft® .NET Framework
InternalName: clr.dll
OriginalFilename: clr.dll
ProductVersion: 4.0.30319.18010
FileVersion: 4.0.30319.18010 built by: FX45RTMGDR
PrivateBuild: DDBLD323
FileDescription: Microsoft .NET Runtime Common Language Runtime - WorkStation
LegalCopyright: © Microsoft Corporation. All rights reserved.
Comments: Flavor=Retail

 

.NET 4.5.3

The product team came back to senses (partially) with .NET 4.5.3 . Still in preview, clr.dll comes with a different version 4.5.22, however it is for now still located at C:\Windows\Microsoft.NET\Framework\v4.0.30319. This all may change when the final version is released.

0:000> lmv m clr
start             end                 module name
00007ffd`56720000 00007ffd`5706e000   clr        (deferred)            
    Image path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
    Image name: clr.dll
    Timestamp:        Fri Oct 03 21:18:02 2014 (542F58DA)
    CheckSum:         0094AB4B
    ImageSize:        0094E000
    File version:     4.5.22.0
    Product version:  4.0.30319.0
    File flags:       8 (Mask 3F) Private
    File OS:          4 Unknown Win32
    File type:        2.0 Dll
    File date:        00000000.00000000
    Translations:     0409.04b0
    CompanyName:      Microsoft Corporation
    ProductName:      Microsoft® .NET Framework
    InternalName:     clr.dll
    OriginalFilename: clr.dll
    ProductVersion:   4.5.22.0
    FileVersion:      4.5.22.0 built by: FX453PREVIEWREL
    PrivateBuild:     DDBLD046C
    FileDescription:  Microsoft .NET Runtime Common Language Runtime - WorkStation
    LegalCopyright:   © Microsoft Corporation.  All rights reserved.

Comments

  • Anonymous
    August 27, 2015
    very helpful.. I thought had the wrong version targeted :)

  • Anonymous
    March 30, 2016
    You write, that .NET 4.5 is from 4.0.30319.17001 to 4.0.3019.18400.May be is to 4.0.30319.18400? You missed 3?

    • Anonymous
      April 06, 2016
      Hi BLACKSnake,You are right. It was a typo.
  • Anonymous
    June 27, 2016
    Would you expand your table to cover versions 4.6, 4.6.1 and 4.6.2 please? I find this table easier to leverage than attempting to read the registry on locked down machines which require admin rights to do so. Thanks.

  • Anonymous
    July 20, 2016
    I always use this PShttp://stackoverflow.com/a/3495491/1747983

  • Anonymous
    January 25, 2017
    CLR.dll is not displaying file version for 4.6.2 ... We do not want to use registry to identify the dotnet version. Are there any other ways

    • Anonymous
      January 26, 2017
      This post shows how to identify without registry. .NET 4.6.x are self-explanatory. Complication arises from .NET 4.5.x
  • Anonymous
    March 14, 2017
    I have a .NET 4.5.1 version that has the number 4.0.30319.34014, and after I install .Net 4.5.2 it has the number 4.0.30319.34209.So it looks like the table above is not correct.

    • Anonymous
      March 30, 2017
      .NET 4.6.* brings a more straightforward approach. The major and minor correspond to the real version
  • Anonymous
    March 27, 2017
    hi ,thanks a lot ; is it correct that .net 4.6.2 has clr.dll with 4.6.2.* and same this all .net after 4.5.2 ?if it is not correct pls explain a walkthrough that get me .:*

    • Anonymous
      March 30, 2017
      Hi ali,That is correct.
      • Anonymous
        October 31, 2018
        Hi, I haven't looked at a machine with .NET FX 4.6.* installed. But this method doesn't seem to work for for 4.7.*. The clr.dll version from my Win10 1803 is 4.7.3190.0 (which would mean 4.7 per the 4.6.x formula), but the registry method says my version is 4.7.2 (Release = 461808). So am I running 4.7? or 4.7.2?
        • Anonymous
          November 01, 2018
          It was written before 4.7.2
  • Anonymous
    May 04, 2017
    Microsoft guys could not solve this simple problem of versioning. What a shame.

  • Anonymous
    November 06, 2017
    Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7afa2Faulting module name: clr.dll, version: 4.0.30319.36415, time stamp: 0x59a664a0Exception code: 0xc0000005Fault offset: 0x00000000000847eeFaulting process id: 0x6f38Faulting application start time: 0x01d35718b3c06948Faulting application path: c:\windows\system32\inetsrv\w3wp.exeFaulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dllReport Id: 8b326f42-c30e-11e7-8e98-d48564519871

    • Anonymous
      November 06, 2017
      OS is windows server 2008 R2 std edt SP1
      • Anonymous
        November 06, 2017
        Hi Keshav,I am not sure if I understand your comment. It seems to be related to other post. Anyway, the error your post is telling you the an IIS Application Pool process is failing with AV (Access Violation). If you let me know more about the context I may be able to help you.
  • Anonymous
    April 09, 2018
    Nice, thanks for the help!